serienrenamer 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,53 +7,59 @@ require File.dirname(__FILE__) + '/test_helper.rb'
7
7
  # information
8
8
  #
9
9
  class TestPluginTextfile < Test::Unit::TestCase
10
- @@directories = {
11
- 'hmym' => 'HMMG.705',
12
- 'hmmg' => 'HMMG.711',
13
- }
10
+ @@directories = {
11
+ 'hmym' => 'HMMG.705',
12
+ 'hmmg' => 'HMMG.711',
13
+ }
14
14
 
15
- def setup
16
- TestHelper.write_episode_textfile(
17
- @@directories["hmym"],
18
- "How.I.Met.Your.Mother.S07E05.Die.Exkursion.German.Dubbed.HDTV.XviD-ITG"
19
- )
15
+ def setup
16
+ TestHelper.write_episode_textfile(
17
+ @@directories["hmym"],
18
+ "How.I.Met.Your.Mother.S07E05.Die.Exkursion.German.Dubbed.HDTV.XviD-ITG"
19
+ )
20
20
 
21
- # two files which contains possible information
22
- TestHelper.write_episode_textfile(
23
- @@directories["hmmg"],
24
- "How.I.Met.Your.Mother.S07E11.Plan.B.German.Dubbed.HDTV.XviD-ITG"
25
- )
26
- TestHelper.write_episode_textfile(
27
- @@directories["hmmg"],
28
- "Show ......... : How I Met Your Mother 7x11
21
+ # two files which contains possible information
22
+ TestHelper.write_episode_textfile(
23
+ @@directories["hmmg"],
24
+ "How.I.Met.Your.Mother.S07E11.Plan.B.German.Dubbed.HDTV.XviD-ITG"
25
+ )
26
+ TestHelper.write_episode_textfile(
27
+ @@directories["hmmg"],
28
+ "Show ......... : How I Met Your Mother 7x11
29
29
  IMDB ......... : http://www.imdb.com/title/tt0460649/
30
30
  Notes ........ : ",
31
31
  "nfo.nfo"
32
- )
33
- TestHelper.cwd
34
- end
32
+ )
33
+ TestHelper.cwd
34
+ end
35
35
 
36
- def teardown
37
- TestHelper.clean
38
- end
36
+ def teardown
37
+ TestHelper.clean
38
+ end
39
39
 
40
- def test_information_extraction
41
- how = Serienrenamer::Episode.new(@@directories['hmym'])
42
- data = Plugin::Textfile.generate_episode_information(how)[0]
43
- how.add_episode_information(data, true)
44
- assert_equal("S07E05 - Die Exkursion.avi", how.to_s)
40
+ def test_information_extraction
41
+ VCR.use_cassette("textfile_#{method_name}") do
42
+ how = Serienrenamer::Episode.new(@@directories['hmym'])
43
+ data = Plugin::Textfile.generate_episode_information(how)[0]
44
+ how.add_episode_information(data, true)
45
+ assert_equal("S07E05 - Die Exkursion.avi", how.to_s)
45
46
  end
47
+ end
46
48
 
47
- def test_select_right_textfile
48
- how = Serienrenamer::Episode.new(@@directories['hmmg'])
49
- data = Plugin::Textfile.generate_episode_information(how)[0]
50
- how.add_episode_information(data, true)
51
- assert_equal("S07E11 - Plan B.avi", how.to_s)
49
+ def test_select_right_textfile
50
+ VCR.use_cassette("textfile_#{method_name}") do
51
+ how = Serienrenamer::Episode.new(@@directories['hmmg'])
52
+ data = Plugin::Textfile.generate_episode_information(how)[0]
53
+ how.add_episode_information(data, true)
54
+ assert_equal("S07E11 - Plan B.avi", how.to_s)
52
55
  end
56
+ end
53
57
 
54
- def test_information_extraction_with_directory_parameter
55
- how = @@directories['hmym']
56
- data = Plugin::Textfile.generate_episode_information(how)[0]
57
- assert_not_nil(data)
58
+ def test_information_extraction_with_directory_parameter
59
+ VCR.use_cassette("textfile_#{method_name}") do
60
+ how = @@directories['hmym']
61
+ data = Plugin::Textfile.generate_episode_information(how)[0]
62
+ assert_not_nil(data)
58
63
  end
64
+ end
59
65
  end
@@ -3,189 +3,193 @@ require File.dirname(__FILE__) + '/test_helper.rb'
3
3
  require 'media_wiki'
4
4
 
5
5
  class TestPluginWikipedia < Test::Unit::TestCase
6
- @@files = {
7
- 'flpo' => 'Flashpoint.S04E04.German.Dubbed.WEB-DL.XViD.avi',
8
- 'dani' => 'Dr.Dani.Santino.S01E04.German.Dubbed.WEB-DL.XViD.avi',
9
- 'two' => 'Two.and.a.half.Men.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
10
- 'simp' => 'Die.Simpsons.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
11
- 'sea' => 'tcpa-seapatrol_s05e11.avi',
12
- }
13
-
14
- @@directories = {
15
- 'chuck' => 'Chuck.S01E01.German.Dubbed.BLURAYRiP.WEB-DL',
16
- 'chuck2' => 'Chuck.S02E10.German.Dubbed.BLURAYRiP.WEB-DL',
17
- }
18
-
19
- def setup
20
- TestHelper.create_test_files(@@files.values)
21
- TestHelper.create_test_dirs(@@directories.values)
22
- TestHelper.cwd
6
+ @@files = {
7
+ 'flpo' => 'Flashpoint.S04E04.German.Dubbed.WEB-DL.XViD.avi',
8
+ 'dani' => 'Dr.Dani.Santino.S01E04.German.Dubbed.WEB-DL.XViD.avi',
9
+ 'two' => 'Two.and.a.half.Men.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
10
+ 'simp' => 'Die.Simpsons.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
11
+ 'sea' => 'tcpa-seapatrol_s05e11.avi',
12
+ }
13
+
14
+ @@directories = {
15
+ 'chuck' => 'Chuck.S01E01.German.Dubbed.BLURAYRiP.WEB-DL',
16
+ 'chuck2' => 'Chuck.S02E10.German.Dubbed.BLURAYRiP.WEB-DL',
17
+ }
18
+
19
+ def setup
20
+ TestHelper.create_test_files(@@files.values)
21
+ TestHelper.create_test_dirs(@@directories.values)
22
+ TestHelper.cwd
23
+ end
24
+
25
+ def teardown
26
+ TestHelper.clean
27
+ end
28
+
29
+ def test_episode_list_page_data_extraction
30
+
31
+ VCR.use_cassette("wiki_#{method_name}") do
32
+ wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
33
+
34
+ data = wiki.get("Liste der Episoden von Bones – Die Knochenjägerin")
35
+ seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
36
+
37
+ assert_equal("Die Frau im Teich", seasons[1][1])
38
+ assert_equal("Ein Verräter im Feuer", seasons[2][11])
39
+ assert_equal("Vom Vergehen und Werden", seasons[6][23])
40
+
41
+ data = wiki.get("Liste der Criminal-Minds-Episoden")
42
+ seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
43
+
44
+ assert_equal("Der Abgrund", seasons[1][1])
45
+ assert_equal("Rivalen", seasons[2][9])
46
+ assert_equal("Valhalla", seasons[6][17])
47
+
48
+ data = wiki.get("Liste der Dexter-Episoden")
49
+ seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
50
+
51
+ assert_equal("Rot wie Blut", seasons[1][10])
52
+ assert_equal("Hitzewelle", seasons[2][4])
53
+ assert_equal("Familienväter", seasons[4][6])
54
+
55
+ data = wiki.get("Liste der Simpsons-Episoden")
56
+ seasons = Plugin::Wikipedia.parse_episodelist_page_data(data, true)
57
+
58
+ assert_equal("Es weihnachtet schwer", seasons[1][1])
59
+ assert_equal("Bösartige Spiele", seasons[4][5])
60
+ assert_equal("Homer an der Uni", seasons[5][3])
61
+ assert_equal("Hochzeit auf Indisch", seasons[9][7])
62
+ assert_equal("G.I. Homer", seasons[18][5])
63
+ assert_equal("Die Farbe Gelb", seasons[21][13])
64
+
65
+ data = wiki.get("Liste der Misfits-Episoden")
66
+ seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
67
+
68
+ assert_equal("Das Gewitter", seasons[1][1])
69
+ assert_equal("Nathan wird Vater", seasons[2][7])
23
70
  end
71
+ end
24
72
 
25
- def teardown
26
- TestHelper.clean
27
- end
73
+ def test_inpage_episode_list_page_data_extraction
28
74
 
29
- def test_episode_list_page_data_extraction
30
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
75
+ VCR.use_cassette("wiki_#{method_name}") do
76
+ wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
31
77
 
32
- data = wiki.get("Liste der Episoden von Bones – Die Knochenjägerin")
33
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
78
+ data = wiki.get("The Glades")
79
+ seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
34
80
 
35
- assert_equal("Die Frau im Teich", seasons[1][1])
36
- assert_equal("Ein Verräter im Feuer", seasons[2][11])
37
- assert_equal("Vom Vergehen und Werden", seasons[6][23])
81
+ assert_equal("Reptilien im Paradies", seasons[1][1])
82
+ assert_equal("Doppelgänger", seasons[1][6])
83
+ assert_equal("Unruhiges Blut", seasons[1][9])
38
84
 
39
- data = wiki.get("Liste der Criminal-Minds-Episoden")
40
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
85
+ data = wiki.get("Royal Pains")
86
+ seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
41
87
 
42
- assert_equal("Der Abgrund", seasons[1][1])
43
- assert_equal("Rivalen", seasons[2][9])
44
- assert_equal("Valhalla", seasons[6][17])
88
+ assert_equal("Auch Reiche sind nur Menschen", seasons[1][1])
89
+ assert_equal("Krank vor Liebe", seasons[2][2])
90
+ assert_equal("Mich trifft der Blitz", seasons[2][16])
45
91
 
46
- data = wiki.get("Liste der Dexter-Episoden")
47
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
92
+ data = wiki.get("Flashpoint Das Spezialkommando")
93
+ seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
48
94
 
49
- assert_equal("Rot wie Blut", seasons[1][10])
50
- assert_equal("Hitzewelle", seasons[2][4])
51
- assert_equal("Familienväter", seasons[4][6])
95
+ assert_equal("Skorpion", seasons[1][1])
96
+ assert_equal("Die Festung", seasons[2][2])
97
+ assert_equal("Der Beschützer", seasons[2][16])
52
98
 
53
- data = wiki.get("Liste der Simpsons-Episoden")
54
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data, true)
99
+ data = wiki.get("Dr. Dani Santino – Spiel des Lebens")
100
+ seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
55
101
 
56
- assert_equal("Es weihnachtet schwer", seasons[1][1])
57
- assert_equal("Bösartige Spiele", seasons[4][5])
58
- assert_equal("Homer an der Uni", seasons[5][3])
59
- assert_equal("Hochzeit auf Indisch", seasons[9][7])
60
- assert_equal("G.I. Homer", seasons[18][5])
61
- assert_equal("Die Farbe Gelb", seasons[21][13])
102
+ assert_equal("Touchdown", seasons[1][1])
103
+ assert_equal("Zickenkrieg", seasons[1][7])
62
104
 
63
- data = wiki.get("Liste der Misfits-Episoden")
64
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
105
+ # the following series have an old inarticle episodelist
106
+ data = wiki.get("Prison Break")
107
+ seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
65
108
 
66
- assert_equal("Das Gewitter", seasons[1][1])
67
- assert_equal("Nathan wird Vater", seasons[2][7])
109
+ assert_equal("Der große Plan", seasons[1][1])
110
+ assert_equal("Seite 1213", seasons[2][5])
68
111
  end
69
-
70
- def test_inpage_episode_list_page_data_extraction
71
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
72
-
73
- data = wiki.get("The Glades")
74
- seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
75
-
76
- assert_equal("Reptilien im Paradies", seasons[1][1])
77
- assert_equal("Doppelgänger", seasons[1][6])
78
- assert_equal("Unruhiges Blut", seasons[1][9])
79
-
80
- data = wiki.get("Royal Pains")
81
- seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
82
-
83
- assert_equal("Auch Reiche sind nur Menschen", seasons[1][1])
84
- assert_equal("Krank vor Liebe", seasons[2][2])
85
- assert_equal("Mich trifft der Blitz", seasons[2][16])
86
-
87
- data = wiki.get("Flashpoint Das Spezialkommando")
88
- seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
89
-
90
- assert_equal("Skorpion", seasons[1][1])
91
- assert_equal("Die Festung", seasons[2][2])
92
- assert_equal("Der Beschützer", seasons[2][16])
93
-
94
- data = wiki.get("Dr. Dani Santino – Spiel des Lebens")
95
- seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
96
-
97
- assert_equal("Touchdown", seasons[1][1])
98
- assert_equal("Zickenkrieg", seasons[1][7])
99
-
100
- # the following series have an old inarticle episodelist
101
- data = wiki.get("Prison Break")
102
- seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
103
-
104
- assert_equal("Der große Plan", seasons[1][1])
105
- assert_equal("Seite 1213", seasons[2][5])
106
-
107
- data = wiki.get("Numbers Die Logik des Verbrechens")
108
- seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
109
-
110
- assert_equal("Brandzeichen", seasons[1][1])
111
- assert_equal("Das Attentat", seasons[2][5])
112
- assert_equal("Gequälte Kreatur", seasons[5][19])
113
- assert_equal("Hauptgewinn", seasons[6][11])
114
-
112
+ end
113
+
114
+
115
+ def test_episode_information_generation
116
+
117
+ VCR.use_cassette("wiki_#{method_name}") do
118
+ flpo = Serienrenamer::Episode.new(@@files['flpo'])
119
+ data = Plugin::Wikipedia.generate_episode_information(flpo)[0]
120
+ flpo.add_episode_information(data, false) if data
121
+ assert_equal("S04E04 - Getrübte Erinnerungen.avi", flpo.to_s)
122
+
123
+ two = Serienrenamer::Episode.new(@@files['two'])
124
+ data = Plugin::Wikipedia.generate_episode_information(two)[0]
125
+ two.add_episode_information(data, false) if data
126
+ assert_equal("S09E07 - Das Tagebuch.avi", two.to_s)
127
+
128
+ simp = Serienrenamer::Episode.new(@@files['simp'])
129
+ data = Plugin::Wikipedia.generate_episode_information(simp)[0]
130
+ simp.add_episode_information(data, false) if data
131
+ assert_equal("S09E07 - Hochzeit auf Indisch.avi", simp.to_s)
132
+
133
+ chuck = Serienrenamer::Episode.new(@@directories['chuck'])
134
+ data = Plugin::Wikipedia.generate_episode_information(chuck)[0]
135
+ chuck.add_episode_information(data, false) if data
136
+ assert_equal("S01E01 - Pilot.avi", chuck.to_s)
137
+
138
+ chuck2 = Serienrenamer::Episode.new(@@directories['chuck2'])
139
+ data = Plugin::Wikipedia.generate_episode_information(chuck2)[0]
140
+ chuck2.add_episode_information(data, false) if data
141
+ assert_equal("S02E10 - Chuck gegen zehn Millionen.avi", chuck2.to_s)
142
+
143
+ dani = Serienrenamer::Episode.new(@@files['dani'])
144
+ data = Plugin::Wikipedia.generate_episode_information(dani)[0]
145
+ dani.add_episode_information(data, false) if data
146
+ assert_equal("S01E04 - Gewohnheiten.avi", dani.to_s)
147
+
148
+ sea = Serienrenamer::Episode.new(@@files['sea'])
149
+ data = Plugin::Wikipedia.generate_episode_information(sea)[0]
150
+ sea.add_episode_information(data, false) if data
151
+ assert_equal("S05E11 - Der Morgen danach.avi", sea.to_s)
115
152
  end
153
+ end
116
154
 
155
+ def test_check_for_series_main_page
117
156
 
118
- def test_episode_information_generation
119
-
120
- flpo = Serienrenamer::Episode.new(@@files['flpo'])
121
- data = Plugin::Wikipedia.generate_episode_information(flpo)[0]
122
- flpo.add_episode_information(data, false) if data
123
- assert_equal("S04E04 - Getrübte Erinnerungen.avi", flpo.to_s)
124
-
125
- two = Serienrenamer::Episode.new(@@files['two'])
126
- data = Plugin::Wikipedia.generate_episode_information(two)[0]
127
- two.add_episode_information(data, false) if data
128
- assert_equal("S09E07 - Das Tagebuch.avi", two.to_s)
129
-
130
- simp = Serienrenamer::Episode.new(@@files['simp'])
131
- data = Plugin::Wikipedia.generate_episode_information(simp)[0]
132
- simp.add_episode_information(data, false) if data
133
- assert_equal("S09E07 - Hochzeit auf Indisch.avi", simp.to_s)
134
-
135
- chuck = Serienrenamer::Episode.new(@@directories['chuck'])
136
- data = Plugin::Wikipedia.generate_episode_information(chuck)[0]
137
- chuck.add_episode_information(data, false) if data
138
- assert_equal("S01E01 - Pilot.avi", chuck.to_s)
139
-
140
- chuck2 = Serienrenamer::Episode.new(@@directories['chuck2'])
141
- data = Plugin::Wikipedia.generate_episode_information(chuck2)[0]
142
- chuck2.add_episode_information(data, false) if data
143
- assert_equal("S02E10 - Chuck gegen zehn Millionen.avi", chuck2.to_s)
157
+ VCR.use_cassette("wiki_#{method_name}") do
158
+ wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
144
159
 
145
- dani = Serienrenamer::Episode.new(@@files['dani'])
146
- data = Plugin::Wikipedia.generate_episode_information(dani)[0]
147
- dani.add_episode_information(data, false) if data
148
- assert_equal("S01E04 - Gewohnheiten.avi", dani.to_s)
149
-
150
- sea = Serienrenamer::Episode.new(@@files['sea'])
151
- data = Plugin::Wikipedia.generate_episode_information(sea)[0]
152
- sea.add_episode_information(data, false) if data
153
- assert_equal("S05E11 - Der Morgen danach.avi", sea.to_s)
160
+ assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones")))
161
+ assert_equal(true, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones – Die Knochenjägerin")))
162
+ assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones Der Tod ist erst der Anfang")))
163
+ assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck")))
164
+ assert_equal(true, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck (Fernsehserie)")))
165
+ assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck (Album)")))
154
166
  end
167
+ end
155
168
 
156
- def test_check_for_series_main_page
157
-
158
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
169
+ def test_check_for_disambiguation_page
159
170
 
160
- assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones")))
161
- assert_equal(true, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones – Die Knochenjägerin")))
162
- assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones – Der Tod ist erst der Anfang")))
163
- assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck")))
164
- assert_equal(true, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck (Fernsehserie)")))
165
- assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck (Album)")))
171
+ VCR.use_cassette("wiki_#{method_name}") do
172
+ wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
166
173
 
174
+ assert_equal(true, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Bones")))
175
+ assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Bones – Die Knochenjägerin")))
176
+ assert_equal(true, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck")))
177
+ assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck (Fernsehserie)")))
178
+ assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck (Album)")))
167
179
  end
168
180
 
169
- def test_check_for_disambiguation_page
181
+ end
170
182
 
171
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
183
+ def test_check_for_inarticle_episode_list
172
184
 
173
- assert_equal(true, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Bones")))
174
- assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Bones – Die Knochenjägerin")))
175
- assert_equal(true, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck")))
176
- assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck (Fernsehserie)")))
177
- assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck (Album)")))
185
+ VCR.use_cassette("wiki_#{method_name}") do
186
+ wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
178
187
 
188
+ assert_equal(false, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("Bones")))
189
+ assert_equal(true, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("The Glades")))
190
+ assert_equal(true, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("Royal Pains")))
179
191
  end
180
192
 
181
- def test_check_for_inarticle_episode_list
182
-
183
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
184
-
185
- assert_equal(false, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("Bones")))
186
- assert_equal(true, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("The Glades")))
187
- assert_equal(true, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("Royal Pains")))
188
-
189
- end
193
+ end
190
194
 
191
195
  end
@@ -0,0 +1,84 @@
1
+ # encoding: UTF-8
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+
4
+ class TestSerienjunkiesOrg < Test::Unit::TestCase
5
+ @@files = {
6
+ 'flpo' => 'Flashpoint.S04E04.German.Dubbed.WEB-DL.XViD.avi',
7
+ 'dani' => 'Dr.Dani.Santino.S01E04.German.Dubbed.WEB-DL.XViD.avi',
8
+ 'two' => 'Two.and.a.half.Men.S06E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
9
+ 'sea' => 'Sea.Patrol.s05e11.avi',
10
+ }
11
+
12
+ def setup
13
+ TestHelper.create_test_files(@@files.values)
14
+ TestHelper.cwd
15
+ end
16
+
17
+ def teardown
18
+ TestHelper.clean
19
+ end
20
+
21
+ def test_seriespage_url_search
22
+
23
+ VCR.use_cassette("sjunkie_org_#{method_name}") do
24
+ plugin = Plugin::SerienjunkiesOrg
25
+
26
+ misfits = plugin.find_link_to_series_page("Misfits")
27
+ assert_equal("http://serienjunkies.org/serie/misfits/", misfits)
28
+
29
+ thementalist = plugin.find_link_to_series_page("The Mentalist")
30
+ assert_equal("http://serienjunkies.org/serie/the-mentalist/", thementalist)
31
+
32
+ ncis = plugin.find_link_to_series_page("NCIS")
33
+ assert_equal("http://serienjunkies.org/serie/ncis/", ncis)
34
+ end
35
+ end
36
+
37
+ def test_parse_seriespage
38
+
39
+ VCR.use_cassette("sjunkie_org_#{method_name}") do
40
+ plugin = Plugin::SerienjunkiesOrg
41
+
42
+ seasons = plugin.parse_seriespage(
43
+ "http://serienjunkies.org/royal-pains/")
44
+ assert_match(/Auch.Reiche.sind.nur.Menschen/, seasons['1_1'])
45
+ assert_match(/Krank.vor.Liebe/, seasons['2_2'])
46
+
47
+ seasons = plugin.parse_seriespage(
48
+ "http://serienjunkies.org/serie/chuck/")
49
+ assert_match(/Chuck.gegen.den.Intersect/, seasons['1_1'])
50
+ assert_match(/Chuck.gegen.den.Tunnel.des.Schreckens/, seasons['4_6'])
51
+
52
+ seasons = plugin.parse_seriespage("http://serienjunkies.org/ncis")
53
+ assert_match(/Sprung.in.den.Tod/, seasons['1_2'])
54
+ assert_match(/Fuer.immer.jung/, seasons['9_2'])
55
+ end
56
+ end
57
+
58
+ def test_episode_information_generation
59
+
60
+ VCR.use_cassette("sjunkie_org_#{method_name}") do
61
+ plugin = Plugin::SerienjunkiesOrg
62
+
63
+ flpo = Serienrenamer::Episode.new(@@files['flpo'])
64
+ data = plugin.generate_episode_information(flpo)[0]
65
+ flpo.add_episode_information(data, true) if data
66
+ assert_equal("S04E04 - Getrübte Erinnerungen.avi", flpo.to_s)
67
+
68
+ dani = Serienrenamer::Episode.new(@@files['dani'])
69
+ data = plugin.generate_episode_information(dani)[0]
70
+ dani.add_episode_information(data, true) if data
71
+ assert_equal("S01E04 - Gewohnheiten.avi", dani.to_s)
72
+
73
+ two = Serienrenamer::Episode.new(@@files['two'])
74
+ data = plugin.generate_episode_information(two)[0]
75
+ two.add_episode_information(data, true) if data
76
+ assert_equal("S06E07 - Alles einsteigen.avi", two.to_s)
77
+
78
+ sea = Serienrenamer::Episode.new(@@files['sea'])
79
+ data = plugin.generate_episode_information(sea)[0]
80
+ sea.add_episode_information(data, true) if data
81
+ assert_equal("S05E11 - Der Morgen danach.avi", sea.to_s)
82
+ end
83
+ end
84
+ end