-
Notifications
You must be signed in to change notification settings - Fork 19
/
test_module.py
103 lines (96 loc) · 4.06 KB
/
test_module.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import plex_poster_set_helper
import pytest
def test_scrapeposterdb_set_tv_series():
soup = plex_poster_set_helper.cook_soup("https://theposterdb.com/set/8846")
movieposters, showposters, collectionposters = plex_poster_set_helper.scrape_posterdb(soup)
assert len(movieposters) == 0
assert len(collectionposters) == 0
assert len(showposters) == 10
for showposter in showposters:
assert showposter["title"] == "Brooklyn Nine-Nine"
assert showposter["year"] == 2013
assert showposter["episode"] == None
assert showposter["season"] == "Cover" or (showposter["season"] >= 0 and showposter["season"] <= 8)
assert showposter["source"] == "posterdb"
def test_scrapeposterdb_set_movie_collection():
soup = plex_poster_set_helper.cook_soup("https://theposterdb.com/set/13035")
movieposters, showposters, collectionposters = plex_poster_set_helper.scrape_posterdb(soup)
assert len(movieposters) == 3
assert len(collectionposters) == 1
assert len(showposters) == 0
for collectionposter in collectionposters:
assert collectionposter["title"] == "The Dark Knight Collection"
assert collectionposter["source"] == "posterdb"
def test_scrape_mediux_set_tv_series():
soup = plex_poster_set_helper.cook_soup("https://mediux.pro/sets/9242")
movieposters, showposters, collectionposters = plex_poster_set_helper.scrape_mediux(soup)
assert len(movieposters) == 0
assert len(collectionposters) == 0
assert len(showposters) == 11
backdrop_count = 0
episode_count = 0
cover_count = 0
for showposter in showposters:
assert showposter["title"] == "Mr. & Mrs. Smith"
assert showposter["year"] == 2024
assert showposter["source"] == "mediux"
if (isinstance(showposter["episode"], int)):
episode_count+=1
elif showposter["episode"] == "Cover":
cover_count+=1
elif showposter["season"] == "Cover":
cover_count+=1
elif showposter["season"] == "Backdrop":
backdrop_count+=1
assert backdrop_count == 1
assert episode_count == 8
assert cover_count == 2
def test_scrape_mediux_set_tv_series_long():
soup = plex_poster_set_helper.cook_soup("https://mediux.pro/sets/13427")
movieposters, showposters, collectionposters = plex_poster_set_helper.scrape_mediux(soup)
assert len(movieposters) == 0
assert len(collectionposters) == 0
assert len(showposters) == 264
backdrop_count = 0
episode_count = 0
cover_count = 0
for showposter in showposters:
assert showposter["title"] == "Modern Family"
assert showposter["year"] == 2009
assert showposter["source"] == "mediux"
if (isinstance(showposter["episode"], int)):
episode_count+=1
elif showposter["episode"] == "Cover":
cover_count+=1
elif showposter["season"] == "Cover":
cover_count+=1
elif showposter["season"] == "Backdrop":
backdrop_count+=1
assert backdrop_count == 1
assert episode_count == 250
assert cover_count == 13
def test_scrape_mediux_boxset():
soup = plex_poster_set_helper.cook_soup("https://mediux.pro/sets/9406")
movieposters, showposters, collectionposters = plex_poster_set_helper.scrape_mediux(soup)
assert len(movieposters) == 0
assert len(collectionposters) == 0
assert len(showposters) == 247
backdrop_count = 0
episode_count = 0
cover_count = 0
for showposter in showposters:
assert showposter["title"] == "Doctor Who"
assert showposter["year"] == 2005
assert showposter["source"] == "mediux"
if (isinstance(showposter["episode"], int)):
episode_count+=1
elif showposter["episode"] == "Cover":
cover_count+=1
elif showposter["season"] == "Cover":
cover_count+=1
elif showposter["season"] == "Backdrop":
backdrop_count+=1
assert backdrop_count == 0
assert episode_count == 232
assert cover_count == 15
test_scrape_mediux_set_tv_series()