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

$

python3 manage.py test functional_tests \

--liveserver=superlists-staging.ottg.eu

======================================================================

ERROR: test_login_with_persona (functional_tests.test_login.LoginTest)

---------------------------------------------------------------------

Traceback (most recent call last):

File "/worskpace/functional_tests/test_login.py", line 50, in

test_login_with_persona

[...]

self.wait_for_element_with_id('id_logout')

[...]

selenium.common.exceptions.TimeoutException: Message: 'Could not find element

with id id_logout. Page text was Superlists\nSign in\nStart a new To-Do list'

======================================================================

ERROR: test_logged_in_users_lists_are_saved_as_my_lists

(functional_tests.test_my_lists.MyListsTest)

---------------------------------------------------------------------

Traceback (most recent call last):

File "/worskpace/functional_tests/test_my_lists.py", line 34, in

test_logged_in_users_lists_are_saved_as_my_lists

self.wait_to_be_logged_in(email)

[...]

selenium.common.exceptions.TimeoutException: Message: 'Could not find element

with id id_logout. Page text was Superlists\nSign in\nStart a new To-Do list'

We can’t log in—either with the real Persona or with our pre-authenticated session.

There’s some kind of bug.

I had considered just going back and fixing this in the previous chapter, and pretending

it never happened, but I think leaving it illustrates the point of running tests against a

staging environment. It would have been pretty embarrassing if we’d deployed this bug

straight to our live site.

Aside from that, we’ll get to practice a bit of server-side debugging.

Setting Up Logging

In order to track this bug down, we have to set up Gunicorn to do some logging. Adjust

the Gunicorn config on the server, using

vi

or

nano

:

server: /etc/init/gunicorn-superlists-staging.ottg.eu.conf.

[

...

]

exec

../virtualenv/bin/gunicorn

\

--bind unix:/tmp/superlists-staging.ottg.eu.socket

\

--access-logfile ../access.log

\

--error-logfile ../error.log

\

superlists

.wsgi:application

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

|

307