X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=test%2Fhowcast_test.rb;h=91c1d6a336c7dcaab4ceb3f185b76df169321351;hb=a557fae384ed2c8f8782ed09e5428e2cf701acf6;hp=5aa0e626df640d4701de439cabb5932433e73b2a;hpb=168ef3b2ccf5b97d561a3c542a18e8e7587de291;p=dead%2Fwhatever-dl.git diff --git a/test/howcast_test.rb b/test/howcast_test.rb index 5aa0e62..91c1d6a 100644 --- a/test/howcast_test.rb +++ b/test/howcast_test.rb @@ -1,15 +1,32 @@ +# +# Copyright Michael Orlitzky +# +# http://michael.orlitzky.com/ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# http://www.fsf.org/licensing/licenses/gpl.html +# + +require 'test/unit' +require 'src/websites/howcast' + # Unit tests for the Howcast class. # This class is easy because get_video_url is # just a string interpolation (we don't have to # test that). -require 'test/unit' -require 'src/websites/howcast' - class HowcastTest < Test::Unit::TestCase - def test_owns_howcast_urls - + def test_owns_howcast_urls assert(Howcast.owns_url?('http://www.howcast.com/videos/6807-2twr')) assert(Howcast.owns_url?('www.howcast.com/videos/6807-2dgfdg')) assert(Howcast.owns_url?('http://howcast.com/videos/6807-cse')) @@ -24,7 +41,23 @@ class HowcastTest < Test::Unit::TestCase assert(!Howcast.owns_url?('redtube.com/6807')) end + def test_doesnt_own_misc_urls assert(!Howcast.owns_url?('http://www.howcast.com/abc')) end + + + def test_parse_file_path_from_xml + hc = Howcast.new(nil) + + page_data = nil + + File.open('test/fixtures/howcast/81134.xml') do |f| + page_data = f.read + end + + test_result = hc.send('parse_file_path_from_xml', page_data) + assert_equal('/system/videos/4/34/11/08/81134.flv', test_result) + end + end