12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ import json
15
16
import re
16
17
17
18
from google .appengine .api import users
@@ -52,11 +53,12 @@ def app(testbed, monkeypatch, login):
52
53
53
54
login (id = '38' )
54
55
56
+ firetactoe .app .debug = True
55
57
return webtest .TestApp (firetactoe .app )
56
58
57
59
58
60
def test_index_new_game (app , monkeypatch ):
59
- mock_http = MockHttp (200 )
61
+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
60
62
monkeypatch .setattr (httplib2 , 'Http' , mock_http )
61
63
62
64
response = app .get ('/' )
@@ -74,7 +76,7 @@ def test_index_new_game(app, monkeypatch):
74
76
75
77
76
78
def test_index_existing_game (app , monkeypatch ):
77
- mock_http = MockHttp (200 )
79
+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
78
80
monkeypatch .setattr (httplib2 , 'Http' , mock_http )
79
81
userX = users .User ('x@example.com' , _user_id = '123' )
80
82
firetactoe .Game (id = 'razem' , userX = userX ).put ()
@@ -97,7 +99,7 @@ def test_index_existing_game(app, monkeypatch):
97
99
98
100
99
101
def test_index_nonexisting_game (app , monkeypatch ):
100
- mock_http = MockHttp (200 )
102
+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
101
103
monkeypatch .setattr (httplib2 , 'Http' , mock_http )
102
104
firetactoe .Game (id = 'razem' , userX = users .get_current_user ()).put ()
103
105
@@ -107,7 +109,7 @@ def test_index_nonexisting_game(app, monkeypatch):
107
109
108
110
109
111
def test_opened (app , monkeypatch ):
110
- mock_http = MockHttp (200 )
112
+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
111
113
monkeypatch .setattr (httplib2 , 'Http' , mock_http )
112
114
firetactoe .Game (id = 'razem' , userX = users .get_current_user ()).put ()
113
115
@@ -119,7 +121,7 @@ def test_opened(app, monkeypatch):
119
121
120
122
121
123
def test_bad_move (app , monkeypatch ):
122
- mock_http = MockHttp (200 )
124
+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
123
125
monkeypatch .setattr (httplib2 , 'Http' , mock_http )
124
126
firetactoe .Game (
125
127
id = 'razem' , userX = users .get_current_user (), board = 9 * ' ' ,
@@ -131,7 +133,7 @@ def test_bad_move(app, monkeypatch):
131
133
132
134
133
135
def test_move (app , monkeypatch ):
134
- mock_http = MockHttp (200 )
136
+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
135
137
monkeypatch .setattr (httplib2 , 'Http' , mock_http )
136
138
firetactoe .Game (
137
139
id = 'razem' , userX = users .get_current_user (), board = 9 * ' ' ,
@@ -148,7 +150,7 @@ def test_move(app, monkeypatch):
148
150
149
151
150
152
def test_delete (app , monkeypatch ):
151
- mock_http = MockHttp (200 )
153
+ mock_http = MockHttp (200 , content = json . dumps ({ 'access_token' : '123' }) )
152
154
monkeypatch .setattr (httplib2 , 'Http' , mock_http )
153
155
firetactoe .Game (id = 'razem' , userX = users .get_current_user ()).put ()
154
156
0 commit comments