-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
738 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
tests/fixtures/api.trakt.tv/shows/1390/progress/watched.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"aired": 10, | ||
"completed": 6, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z", | ||
"reset_at": "2015-03-21T19:03:58.000Z", | ||
"seasons": [ | ||
{ | ||
"number": 1, | ||
"aired": 8, | ||
"completed": 6, | ||
"episodes": [ | ||
{ | ||
"number": 1, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 2, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 3, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 4, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 5, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 6, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 7, | ||
"completed": false, | ||
"last_watched_at": null | ||
}, | ||
{ | ||
"number": 8, | ||
"completed": false, | ||
"last_watched_at": null | ||
}, | ||
{ | ||
"number": 9, | ||
"completed": false, | ||
"last_watched_at": null | ||
}, | ||
{ | ||
"number": 10, | ||
"completed": false, | ||
"last_watched_at": null | ||
} | ||
] | ||
} | ||
], | ||
"hidden_seasons": [], | ||
"next_episode": { | ||
"season": 1, | ||
"number": 7, | ||
"title": "You Win or You Die", | ||
"ids": { | ||
"trakt": 73646, | ||
"tvdb": 3436461, | ||
"imdb": "tt1837863", | ||
"tmdb": 63062, | ||
"tvrage": 1065036404 | ||
} | ||
}, | ||
"last_episode": { | ||
"season": 1, | ||
"number": 5, | ||
"title": "You Die and You Win", | ||
"ids": { | ||
"trakt": 73646, | ||
"tvdb": 3436461, | ||
"imdb": "tt1837863", | ||
"tmdb": 63062, | ||
"tvrage": 1065036404 | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
tests/fixtures/api.trakt.tv/shows/game-of-thrones/progress/watched.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"aired": 10, | ||
"completed": 6, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z", | ||
"reset_at": null, | ||
"seasons": [ | ||
{ | ||
"number": 1, | ||
"aired": 8, | ||
"completed": 6, | ||
"episodes": [ | ||
{ | ||
"number": 1, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 2, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 3, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 4, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 5, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 6, | ||
"completed": true, | ||
"last_watched_at": "2015-03-21T19:03:58.000Z" | ||
}, | ||
{ | ||
"number": 7, | ||
"completed": false, | ||
"last_watched_at": null | ||
}, | ||
{ | ||
"number": 8, | ||
"completed": false, | ||
"last_watched_at": null | ||
}, | ||
{ | ||
"number": 9, | ||
"completed": false, | ||
"last_watched_at": null | ||
}, | ||
{ | ||
"number": 10, | ||
"completed": false, | ||
"last_watched_at": null | ||
} | ||
] | ||
} | ||
], | ||
"hidden_seasons": [ | ||
{ | ||
"number": 2, | ||
"ids": { | ||
"trakt": 3051, | ||
"tvdb": 498968, | ||
"tmdb": 53334 | ||
} | ||
} | ||
], | ||
"next_episode": { | ||
"season": 1, | ||
"number": 7, | ||
"title": "You Win or You Die", | ||
"ids": { | ||
"trakt": 73646, | ||
"tvdb": 3436461, | ||
"imdb": "tt1837863", | ||
"tmdb": 63062, | ||
"tvrage": 1065036404 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from tests.core import mock | ||
from trakt import Trakt | ||
|
||
from hamcrest import assert_that, has_entries | ||
from httmock import HTTMock | ||
|
||
|
||
def test_watched_progress(): | ||
with HTTMock(mock.fixtures, mock.unknown): | ||
with Trakt.configuration.auth('mock', 'mock'): | ||
progress = Trakt['shows'].watched_progress(1390) | ||
|
||
assert progress is not None | ||
assert progress.reset_at is not None | ||
assert progress.last_progress_change is not None | ||
assert progress.aired == 10 | ||
assert progress.completed == 6 | ||
|
||
assert len(progress.seasons) == 1 | ||
assert progress.seasons[1].aired == 8 | ||
assert progress.seasons[1].completed == 6 | ||
|
||
assert len(progress.seasons[1].episodes) == 10 | ||
assert progress.seasons[1].episodes[1].progress_timestamp is not None | ||
|
||
assert len(progress.hidden_seasons) == 0 | ||
|
||
assert progress.next_episode.pk == (1, 7) | ||
assert progress.last_episode.pk == (1, 5) | ||
|
||
|
||
def test_watched_progress_plus_hidden(): | ||
with HTTMock(mock.fixtures, mock.unknown): | ||
with Trakt.configuration.auth('mock', 'mock'): | ||
progress = Trakt['shows'].watched_progress('game-of-thrones', hidden=True) | ||
|
||
assert progress is not None | ||
assert progress.reset_at is None | ||
|
||
assert len(progress.hidden_seasons) == 1 | ||
|
||
assert_that(progress.to_dict(), has_entries({ | ||
'aired': 10, | ||
'completed': 6, | ||
'last_watched_at': '2015-03-21T19:03:58.000-00:00', | ||
'reset_at': None, | ||
'seasons': [ | ||
{ | ||
'number': 1, | ||
'aired': 8, | ||
'completed': 6, | ||
'episodes': [ | ||
{ | ||
'number': 1, | ||
'completed': True, | ||
'last_watched_at': '2015-03-21T19:03:58.000-00:00' | ||
}, | ||
{ | ||
'number': 2, | ||
'completed': True, | ||
'last_watched_at': '2015-03-21T19:03:58.000-00:00' | ||
}, | ||
{ | ||
'number': 3, | ||
'completed': True, | ||
'last_watched_at': '2015-03-21T19:03:58.000-00:00' | ||
}, | ||
{ | ||
'number': 4, | ||
'completed': True, | ||
'last_watched_at': '2015-03-21T19:03:58.000-00:00' | ||
}, | ||
{ | ||
'number': 5, | ||
'completed': True, | ||
'last_watched_at': '2015-03-21T19:03:58.000-00:00' | ||
}, | ||
{ | ||
'number': 6, | ||
'completed': True, | ||
'last_watched_at': '2015-03-21T19:03:58.000-00:00' | ||
}, | ||
{ | ||
'number': 7, | ||
'completed': False, | ||
'last_watched_at': None | ||
}, | ||
{ | ||
'number': 8, | ||
'completed': False, | ||
'last_watched_at': None | ||
}, | ||
{ | ||
'number': 9, | ||
'completed': False, | ||
'last_watched_at': None | ||
}, | ||
{ | ||
'number': 10, | ||
'completed': False, | ||
'last_watched_at': None | ||
} | ||
] | ||
} | ||
], | ||
'hidden_seasons': [ | ||
{ | ||
'number': 2, | ||
'ids': { | ||
'trakt': '3051', | ||
'tvdb': '498968', | ||
'tmdb': '53334' | ||
} | ||
} | ||
], | ||
'next_episode': { | ||
'season': 1, | ||
'number': 7, | ||
'title': 'You Win or You Die', | ||
'ids': { | ||
'trakt': '73646', | ||
'tvdb': '3436461', | ||
'imdb': 'tt1837863', | ||
'tmdb': '63062', | ||
'tvrage': '1065036404' | ||
} | ||
} | ||
})) | ||
|
||
|
||
def test_collection_progress(): | ||
with HTTMock(mock.fixtures, mock.unknown): | ||
with Trakt.configuration.auth('mock', 'mock'): | ||
progress = Trakt['shows'].collection_progress(1390) | ||
|
||
assert progress is not None | ||
assert progress.reset_at is None | ||
assert progress.last_progress_change is not None | ||
|
||
assert progress.seasons[1].episodes[1].progress_timestamp is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.