]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blob - test/fuckedtube_test.rb
Fix a missing slash.
[dead/whatever-dl.git] / test / fuckedtube_test.rb
1 #
2 # Copyright Michael Orlitzky
3 #
4 # http://michael.orlitzky.com/
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # http://www.fsf.org/licensing/licenses/gpl.html
17 #
18
19 require 'test/unit'
20 require 'src/websites/fuckedtube'
21
22
23 class FuckedtubeTest < Test::Unit::TestCase
24
25 def test_owns_fuckedtube_urls
26 assert(Fuckedtube.owns_url?('http://www.fuckedtube.com/video/161/Pumped-Pussy/'))
27 assert(Fuckedtube.owns_url?('http://www.fuckedtube.com/video/152/Hits-From-The-Pong'))
28 assert(Fuckedtube.owns_url?('http://www.fuckedtube.com/video/143/Hot-n-Spicy-Jizz/'))
29 assert(Fuckedtube.owns_url?('http://www.fuckedtube.com/video/4/I-Spy-A-Cervix'))
30 end
31
32
33 def test_doesnt_own_infoq_urls
34 assert(!Fuckedtube.owns_url?('http://www.infoq.com/interviews/jim-weirich-discusses-rake'))
35 end
36
37
38 def test_doesnt_own_efukt_urls
39 assert(!Fuckedtube.owns_url?('http://www.efukt.com/2308_How_To_Fuck_Like_A_King.html'))
40 assert(!Fuckedtube.owns_url?('http://www.efukt.com/2304_The_Dumbest_Porno_Ever_Made.html'))
41 end
42
43
44 def test_parse_video_url
45 ft = Fuckedtube.new(nil)
46
47 page_data = nil
48
49 File.open('test/fixtures/fuckedtube/3.html') do |f|
50 page_data = f.read
51 end
52
53 test_result = ft.send('parse_video_url', page_data)
54 assert_equal('http://www.fuckedtube.com/videos/br_scan.flv', test_result)
55 end
56
57 end