2 # Copyright Michael Orlitzky
4 # http://michael.orlitzky.com/
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.
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.
16 # http://www.fsf.org/licensing/licenses/gpl.html
20 require 'src/websites/howcast'
22 # Unit tests for the Howcast class.
23 # This class is easy because get_video_url is
24 # just a string interpolation (we don't have to
27 class HowcastTest
< Test
::Unit::TestCase
29 def test_owns_howcast_urls
30 assert(Howcast
.owns_url
?('http://www.howcast.com/videos/6807-2twr'))
31 assert(Howcast
.owns_url
?('www.howcast.com/videos/6807-2dgfdg'))
32 assert(Howcast
.owns_url
?('http://howcast.com/videos/6807-cse'))
33 assert(Howcast
.owns_url
?('howcast.com/videos/6807-asdgasd'))
37 def test_doesnt_own_redtube_urls
38 assert(!Howcast
.owns_url
?('http://www.redtube.com/6807'))
39 assert(!Howcast
.owns_url
?('www.redtube.com/6807'))
40 assert(!Howcast
.owns_url
?('http://redtube.com/6807'))
41 assert(!Howcast
.owns_url
?('redtube.com/6807'))
45 def test_doesnt_own_misc_urls
46 assert(!Howcast
.owns_url
?('http://www.howcast.com/abc'))
50 def test_parse_file_path_from_xml
55 File
.open('test/fixtures/howcast/81134.xml') do |f
|
59 test_result
= hc
.send('parse_file_path_from_xml', page_data
)
60 assert_equal('/system/videos/4/34/11/08/81134.flv', test_result
)