-
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
4 changed files
with
136 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[ | ||
{ | ||
"progress": 10, | ||
"paused_at": "2015-01-25T22:01:32.000Z", | ||
"id": 13, | ||
"type": "movie", | ||
"movie": { | ||
"title": "Batman Begins", | ||
"year": 2005, | ||
"ids": { | ||
"trakt": 1, | ||
"slug": "batman-begins-2005", | ||
"imdb": "tt0372784", | ||
"tmdb": 272 | ||
} | ||
} | ||
}, | ||
{ | ||
"progress": 65.5, | ||
"paused_at": "2015-01-25T22:01:32.000Z", | ||
"id": 37, | ||
"type": "episode", | ||
"episode": { | ||
"season": 0, | ||
"number": 1, | ||
"title": "Good Cop Bad Cop", | ||
"ids": { | ||
"trakt": 1, | ||
"tvdb": 3859781, | ||
"imdb": "", | ||
"tmdb": 62131, | ||
"tvrage": null | ||
} | ||
}, | ||
"show": { | ||
"title": "Breaking Bad", | ||
"year": 2008, | ||
"ids": { | ||
"trakt": 1, | ||
"slug": "breaking-bad", | ||
"tvdb": 81189, | ||
"imdb": "tt0903747", | ||
"tmdb": 1396, | ||
"tvrage": 18164 | ||
} | ||
} | ||
} | ||
] |
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,72 @@ | ||
from tests.core.helpers import authenticated_response | ||
|
||
from datetime import datetime | ||
from dateutil.tz import tzutc | ||
from hamcrest import * | ||
from trakt import Trakt | ||
from trakt.objects import Movie, Show, Episode | ||
import responses | ||
|
||
|
||
@responses.activate | ||
def test_basic(): | ||
responses.add_callback( | ||
responses.GET, 'http://mock/sync/playback', | ||
callback=authenticated_response('fixtures/sync/playback/delete.json'), | ||
content_type='application/json' | ||
) | ||
|
||
Trakt.base_url = 'http://mock' | ||
|
||
with Trakt.configuration.auth('mock', 'mock'): | ||
collection = Trakt['sync/playback'].get() | ||
|
||
# Ensure collection is valid | ||
assert_that(collection, not_none()) | ||
|
||
# Batman Begins (2005) | ||
assert_that(collection[('imdb', 'tt0372784')], has_properties({ | ||
'id': 13 | ||
})) | ||
|
||
# Breaking Bad (2008) | ||
assert_that(collection[('tvdb', '81189')], has_properties({ | ||
|
||
# Seasons | ||
'seasons': all_of( | ||
has_length(1), | ||
|
||
# Seasons | ||
has_entry(0, has_properties({ | ||
'episodes': all_of( | ||
has_length(1), | ||
|
||
# Episodes | ||
has_entry(1, has_properties({ | ||
'id': 37 | ||
})) | ||
) | ||
})) | ||
), | ||
})) | ||
|
||
# Batman Begins (2005) | ||
responses.add_callback( | ||
responses.DELETE, 'http://mock/sync/playback/13', # 13 = collection[('imdb', 'tt0372784')].id | ||
callback=authenticated_response(data='{"mock": "mock"}'), | ||
content_type='application/json' | ||
) | ||
|
||
# Breaking Bad (2008) - S00E01 - Good Cop Bad Cop | ||
responses.add_callback( | ||
responses.DELETE, 'http://mock/sync/playback/37', # 37 = collection[('tvdb', '81189')].seasons[0].episodes[1].id | ||
callback=authenticated_response(data='{"mock": "mock"}'), | ||
content_type='application/json' | ||
) | ||
|
||
with Trakt.configuration.auth('mock', 'mock'): | ||
success_movie = Trakt['sync/playback'].delete(13) | ||
success_episode = Trakt['sync/playback'].delete(37) | ||
|
||
assert success_movie is True | ||
assert success_episode is True |
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