1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import json
1516import re
1617
1718from google .appengine .api import users
@@ -52,11 +53,12 @@ def app(testbed, monkeypatch, login):
5253
5354 login (id = '38' )
5455
56+ firetactoe .app .debug = True
5557 return webtest .TestApp (firetactoe .app )
5658
5759
5860def test_index_new_game (app , monkeypatch ):
59- mock_http = MockHttp (200 )
61+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
6062 monkeypatch .setattr (httplib2 , 'Http' , mock_http )
6163
6264 response = app .get ('/' )
@@ -74,7 +76,7 @@ def test_index_new_game(app, monkeypatch):
7476
7577
7678def test_index_existing_game (app , monkeypatch ):
77- mock_http = MockHttp (200 )
79+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
7880 monkeypatch .setattr (httplib2 , 'Http' , mock_http )
7981 userX = users .User ('x@example.com' , _user_id = '123' )
8082 firetactoe .Game (id = 'razem' , userX = userX ).put ()
@@ -97,7 +99,7 @@ def test_index_existing_game(app, monkeypatch):
9799
98100
99101def test_index_nonexisting_game (app , monkeypatch ):
100- mock_http = MockHttp (200 )
102+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
101103 monkeypatch .setattr (httplib2 , 'Http' , mock_http )
102104 firetactoe .Game (id = 'razem' , userX = users .get_current_user ()).put ()
103105
@@ -107,7 +109,7 @@ def test_index_nonexisting_game(app, monkeypatch):
107109
108110
109111def test_opened (app , monkeypatch ):
110- mock_http = MockHttp (200 )
112+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
111113 monkeypatch .setattr (httplib2 , 'Http' , mock_http )
112114 firetactoe .Game (id = 'razem' , userX = users .get_current_user ()).put ()
113115
@@ -119,7 +121,7 @@ def test_opened(app, monkeypatch):
119121
120122
121123def test_bad_move (app , monkeypatch ):
122- mock_http = MockHttp (200 )
124+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
123125 monkeypatch .setattr (httplib2 , 'Http' , mock_http )
124126 firetactoe .Game (
125127 id = 'razem' , userX = users .get_current_user (), board = 9 * ' ' ,
@@ -131,7 +133,7 @@ def test_bad_move(app, monkeypatch):
131133
132134
133135def test_move (app , monkeypatch ):
134- mock_http = MockHttp (200 )
136+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
135137 monkeypatch .setattr (httplib2 , 'Http' , mock_http )
136138 firetactoe .Game (
137139 id = 'razem' , userX = users .get_current_user (), board = 9 * ' ' ,
@@ -148,7 +150,7 @@ def test_move(app, monkeypatch):
148150
149151
150152def test_delete (app , monkeypatch ):
151- mock_http = MockHttp (200 )
153+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
152154 monkeypatch .setattr (httplib2 , 'Http' , mock_http )
153155 firetactoe .Game (id = 'razem' , userX = users .get_current_user ()).put ()
154156
0 commit comments