Skip to content

Commit 76d1401

Browse files
committed
Cast to tuple
1 parent 1628a81 commit 76d1401

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

tests/test_scrobble.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,35 @@ def test_scrobbler_payload_excludes_app_metadata():
3232
guardians = Movie('Guardians of the Galaxy', year=2014)
3333
scrobbler = Scrobbler(guardians, 42.0, '1.0.0', '2015-02-01')
3434

35+
# 3.7
36+
#
37+
# tests/test_scrobble.py::test_scrobbler_payload_excludes_app_metadata
38+
# call_args: call('scrobble/start', {'progress': 42.0, 'movie': {'title': 'Guardians of the Galaxy', 'year': 2014, 'ids': {'imdb': 'tt1104001', 'slug': 'guardians-of-the-galaxy-2014', 'tmdb': 20526, 'trakt': 343}}})
39+
# args: args
40+
# tuple: (('scrobble/start', {'progress': 42.0, 'movie': {'title': 'Guardians of the Galaxy', 'year': 2014, 'ids': {'imdb': 'tt1104001', 'slug': 'guardians-of-the-galaxy-2014', 'tmdb': 20526, 'trakt': 343}}}), {})
41+
# PASSED
42+
43+
# 3.9
44+
#tests/test_scrobble.py::test_scrobbler_payload_excludes_app_metadata
45+
# call_args: call('scrobble/start', {'progress': 42.0, 'movie': {'title': 'Guardians of the Galaxy', 'year': 2014, 'ids': {'imdb': 'tt1104001', 'slug': 'guardians-of-the-galaxy-2014', 'tmdb': 20526, 'trakt': 343}}})
46+
# args: ('scrobble/start', {'progress': 42.0, 'movie': {'title': 'Guardians of the Galaxy', 'year': 2014, 'ids': {'imdb': 'tt1104001', 'slug': 'guardians-of-the-galaxy-2014', 'tmdb': 20526, 'trakt': 343}}})
47+
# tuple: (('scrobble/start', {'progress': 42.0, 'movie': {'title': 'Guardians of the Galaxy', 'year': 2014, 'ids': {'imdb': 'tt1104001', 'slug': 'guardians-of-the-galaxy-2014', 'tmdb': 20526, 'trakt': 343}}}), {})
48+
# PASSED
49+
# tests/test_search.py::test_search_movie PASSED
50+
3551
with patch.object(trakt.core.api(), 'post', return_value=None) as mock_post:
3652
scrobbler.start()
3753

3854
print("call_args:", mock_post.call_args)
3955
print("args:", getattr(mock_post.call_args, "args", None))
4056
print("tuple:", tuple(mock_post.call_args))
4157

42-
# args = mock_post.call_args.args
43-
# assert len(args) >= 2
44-
# payload = args[-1]
45-
# assert isinstance(payload, dict)
46-
#
47-
# assert payload['progress'] == 42.0
48-
# assert 'app_version' not in payload
49-
# assert 'app_date' not in payload
50-
# assert 'date' not in payload
58+
args = tuple(mock_post.call_args.args)
59+
assert len(args) >= 2
60+
payload = args[-1]
61+
assert isinstance(payload, dict)
62+
63+
assert payload['progress'] == 42.0
64+
assert 'app_version' not in payload
65+
assert 'app_date' not in payload
66+
assert 'date' not in payload

0 commit comments

Comments
 (0)