Skip to content

Commit

Permalink
Added record duplication test
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzeman committed Sep 18, 2016
1 parent 18a0d71 commit c4ed227
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion tests/tasks/history/duplicates/scan_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_duplicate_single_movie():


#
#
# Unique
#


Expand Down Expand Up @@ -326,3 +326,61 @@ def test_unique_movie():

# Validate entry
assert scanner.movies.get('4') is None


#
# Record duplication
#


def test_record_duplication():
scanner = ScanHistoryDuplicatesTask(
delta_max=600
)

# Process history
assert scanner.process_item({
'action': 'scrobble',
'type': 'movie',

'id': 1,
'watched_at': '2014-03-31T09:28:53.000Z',

'movie': {
'title': 'The Dark Knight',
'year': 2008,

'ids': {
'trakt': 4,
'slug': 'the-dark-knight-2008',
'imdb': 'tt0468569',
'tmdb': 155
}
}
}) is True

assert scanner.process_item({
'action': 'scrobble',
'type': 'movie',

'id': 1,
'watched_at': '2014-03-31T09:20:53.000Z',

'movie': {
'title': 'The Dark Knight',
'year': 2008,

'ids': {
'trakt': 4,
'slug': 'the-dark-knight-2008',
'imdb': 'tt0468569',
'tmdb': 155
}
}
}) is True

# Close scanner
scanner.close()

# Validate entry
assert scanner.movies.get('4') is None

0 comments on commit c4ed227

Please sign in to comment.