Background Image
Table of Contents Table of Contents
Previous Page  334 / 478 Next Page
Information
Show Menu
Previous Page 334 / 478 Next Page
Page Background

Just to check we haven’t broken anything, we rerun the login test:

$

python3 manage.py test functional_tests.test_login

[...]

OK

And now we can write a placeholder for the “My Lists” test, to see if our pre-

authenticated session creator really does work:

functional_tests/test_my_lists.py (ch17l004).

def

test_logged_in_users_lists_are_saved_as_my_lists

(

self

):

email

=

'edith@example.com'

self

.

browser

.

get

(

self

.

server_url

)

self

.

wait_to_be_logged_out

(

email

)

# Edith is a logged-in user

self

.

create_pre_authenticated_session

(

email

)

self

.

browser

.

get

(

self

.

server_url

)

self

.

wait_to_be_logged_in

(

email

)

That gets us:

$

python3 manage.py test functional_tests.test_my_lists

[...]

OK

That’s a good place for a commit:

$

git add functional_tests

$

git commit -m"placeholder test_my_lists and move login checkers into base"

The Proof Is in the Pudding: Using Staging to Catch Final

Bugs

That’s all very well for running the FTs locally, but howwould it work against the staging

server? Let’s try and deploy our site. Along the way we’ll catch an unexpected bug (that’s

what staging is for!), and then we’ll have to figure out a way of managing the database

on the test server.

$

cd deploy_tools

$

fab deploy --host=superlists-staging.ottg.eu

[...]

And restart Gunicorn…

elspeth@server

:

sudo restart gunicorn-superlists-staging.ottg.eu

Here’s what happens when we run the functional tests:

306

|

Chapter 17: Test Fixtures, Logging, and Server-Side Debugging