@@ -41,7 +41,7 @@ def client_with_credentials(app):
4141 def inner ():
4242 with app .test_client () as client :
4343 with client .session_transaction () as session :
44- session ['profile' ] = {'id ' : 'abc' , 'displayName ' : 'Test User' }
44+ session ['profile' ] = {'email ' : 'abc@example.com ' , 'name ' : 'Test User' }
4545 session ['google_oauth2_credentials' ] = credentials .to_json ()
4646 yield client
4747
@@ -57,22 +57,21 @@ def inner():
5757# in conftest.py
5858@pytest .mark .usefixtures ('app' , 'model' )
5959class TestAuth (object ):
60-
6160 def test_not_logged_in (self , app ):
6261 with app .test_client () as c :
63- rv = c .get ('/books/mine ' )
62+ rv = c .get ('/books/' )
6463
65- assert rv .status < '400 '
64+ assert rv .status == '200 OK '
6665 body = rv .data .decode ('utf-8' )
67- assert 'Redirecting ' in body
66+ assert 'Login ' in body
6867
6968 def test_logged_in (self , client_with_credentials ):
7069 with client_with_credentials () as c :
71- rv = c .get ('/books/mine ' )
70+ rv = c .get ('/books/' )
7271
73- assert rv .status < '400 '
72+ assert rv .status == '200 OK '
7473 body = rv .data .decode ('utf-8' )
75- assert 'Redirecting' not in body
74+ assert 'Test User' in body
7675
7776 def test_add_anonymous (self , app ):
7877 data = {
@@ -105,12 +104,12 @@ def test_mine(self, model, client_with_credentials):
105104 # created by another user.
106105 model .create ({
107106 'title' : 'Book 1' ,
108- 'createdById' : 'abc'
107+ 'createdById' : 'abc@example.com '
109108 })
110109
111110 model .create ({
112111 'title' : 'Book 2' ,
113- 'createdById' : 'def'
112+ 'createdById' : 'def@example.com '
114113 })
115114
116115 # Check the "My Books" page and make sure only one of the books
0 commit comments