Skip to content

Commit

Permalink
edit funnel tests to account for different data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
zapplecat committed Sep 25, 2016
1 parent b4cf6b9 commit fc9c837
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions tele_giphy/game/tests/test_giphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,18 @@ def test_funnel(self, json_filename):
if 'random' in json_filename:
resp = giphy_call(call_type='random')
expected = {'call_type': 'random',
'image_url': '',
'phrase': '',
'meta': {}}
# expected = load_json("random_{}.json".format(self.status))
'image_url': 'http://media0.giphy.com/media/VelUfLV3j2dOM/giphy.gif',
'phrase': 'doge',
'meta': {'status': 200, 'msg': 'OK'}}
else:
resp = giphy_call()
expected = load_json("random_{}.json".format(self.status))
expected = self.json
expected = {'call_type': 'translate',
'image_url': 'http://media3.giphy.com/media/G51FVzyR21464/giphy.gif',
'phrase': 'doge',
'meta': {'status': 200, 'msg': 'OK'}}
assert resp['meta']['status'] == 200
# Check standarized dict
# asserts expected == loaded_json
# Check standarized; dict
assert expected == resp

# Tests giphy get 403
@pytest.mark.parametrize("json_filename", ['translate_403.json', 'random_403.json'])
Expand Down Expand Up @@ -110,11 +111,16 @@ def test_functions(self, json_filename):
def test_funnel(self, json_filename):
if 'random' in json_filename:
resp = giphy_call(call_type='random', api_key='abc')
expected = load_json("random_{}.json".format(self.status))
expected = {'call_type': '',
'image_url': '',
'phrase': '',
'meta': {'status': 403, 'msg': 'Forbidden'}}
else:
resp = giphy_call(api_key='abc')
expected = load_json("translate_{}.json".format(self.status))
expected = {'call_type': '',
'image_url': '',
'phrase': '',
'meta': {'status': 403, 'msg': 'Forbidden'}}
assert resp['meta']['status'] == 403
# Check standarized dict
# loaded_json = resp.json()
# assert expected == loaded_json
assert expected == resp

0 comments on commit fc9c837

Please sign in to comment.