41d7204fcc62d0d820617253c353406630bcea0a,appengine/standard/firebase/firetactoe/firetactoe_test.py,,test_move,#Any#Any#,135
Before Change
def test_move(app, monkeypatch):
mock_http = MockHttp(200, content=json.dumps({"access_token": "123"}))
monkeypatch.setattr(httplib2, "Http", mock_http)
firetactoe.Game(
id="razem", userX=users.get_current_user(), board=9*" ",
moveX=True).put()
After Change
def test_move(app, monkeypatch):
with mock.patch(
"google.auth.transport.requests.AuthorizedSession.request", autospec=True
) as auth_session:
data = {"access_token": "123"}
auth_session.return_value = MockResponse(data, http_client.OK)
firetactoe.Game(
id="razem", userX=users.get_current_user(), board=9*" ",
moveX=True).put()
app.post("/move?g=razem", {"i": 0}, status=200)
game = ndb.Key("Game", "razem").get()
assert game.board == "X" + (8 * " ")
auth_session.assert_called_once_with(
mock.ANY, // AuthorizedSession object
method="PATCH",
url="http://firebase.com/test-db-url/channels/38razem.json",
body="{"winner": null, "userX": "38", "moveX": false, "winningBoard": null, "board": "X ", "userO": null}",
data=None,
)
def test_delete(app, monkeypatch):
with mock.patch(
"google.auth.transport.requests.AuthorizedSession.request", autospec=True
) as auth_session:
In pattern: SUPERPATTERN
Frequency: 7
Non-data size: 15
Instances
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 41d7204fcc62d0d820617253c353406630bcea0a
Time: 2020-05-13
Author: 8822365+busunkim96@users.noreply.github.com
File Name: appengine/standard/firebase/firetactoe/firetactoe_test.py
Class Name:
Method Name: test_move
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 41d7204fcc62d0d820617253c353406630bcea0a
Time: 2020-05-13
Author: 8822365+busunkim96@users.noreply.github.com
File Name: appengine/standard/firebase/firetactoe/firetactoe_test.py
Class Name:
Method Name: test_index_nonexisting_game
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 41d7204fcc62d0d820617253c353406630bcea0a
Time: 2020-05-13
Author: 8822365+busunkim96@users.noreply.github.com
File Name: appengine/standard/firebase/firetactoe/firetactoe_test.py
Class Name:
Method Name: test_bad_move
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 41d7204fcc62d0d820617253c353406630bcea0a
Time: 2020-05-13
Author: 8822365+busunkim96@users.noreply.github.com
File Name: appengine/standard/firebase/firetactoe/firetactoe_test.py
Class Name:
Method Name: test_index_existing_game
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 41d7204fcc62d0d820617253c353406630bcea0a
Time: 2020-05-13
Author: 8822365+busunkim96@users.noreply.github.com
File Name: appengine/standard/firebase/firetactoe/firetactoe_test.py
Class Name:
Method Name: test_opened
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 41d7204fcc62d0d820617253c353406630bcea0a
Time: 2020-05-13
Author: 8822365+busunkim96@users.noreply.github.com
File Name: appengine/standard/firebase/firetactoe/firetactoe_test.py
Class Name:
Method Name: test_delete
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 41d7204fcc62d0d820617253c353406630bcea0a
Time: 2020-05-13
Author: 8822365+busunkim96@users.noreply.github.com
File Name: appengine/standard/firebase/firetactoe/firetactoe_test.py
Class Name:
Method Name: test_index_new_game