X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=test%2Fveoh_test.rb;h=f28229a5a1debb85999d312f45a35d939120a9fa;hb=a2db80e86e587d5e4e89a02a56439e6c39cdebdf;hp=f104d3a807f6b24325acba7fbcc2ee081db96f34;hpb=cb1b5a8a87ec46656e3d860c208210a5cc24a32e;p=dead%2Fwhatever-dl.git diff --git a/test/veoh_test.rb b/test/veoh_test.rb index f104d3a..f28229a 100644 --- a/test/veoh_test.rb +++ b/test/veoh_test.rb @@ -1,17 +1,56 @@ +# +# 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/veoh' class VeohTest < Test::Unit::TestCase def test_parse_video_id - v = Veoh.new - video_id = v.send('parse_video_id', 'http://www.veoh.com/videos/v801204yMZ8BWcC') + v = Veoh.new('http://www.veoh.com/videos/v801204yMZ8BWcC') + video_id = v.send('parse_video_id') assert_equal('v801204yMZ8BWcC', video_id) end + + def test_parse_second_video_id + v = Veoh.new('http://www.veoh.com/videos/v15795090Z6mZAbSq') + video_id = v.send('parse_video_id') + assert_equal('v15795090Z6mZAbSq', video_id) + end + + + def test_parse_third_video_id + v = Veoh.new('http://www.veoh.com/group/suggested-anime-w1st-episodes/?source=homepageList#watch%3Dv19961527w773Qq5G') + video_id = v.send('parse_video_id') + assert_equal('v19961527w773Qq5G', video_id) + end + + + def test_parse_fourth_video_id + v = Veoh.new('http://www.veoh.com/browse/videos/category/anime/watch/v19568793XZq2SRzZ') + video_id = v.send('parse_video_id') + assert_equal('v19568793XZq2SRzZ', video_id) + end + def test_parse_redirect_url - v = Veoh.new + v = Veoh.new(nil) details_data = nil @@ -24,10 +63,30 @@ class VeohTest < Test::Unit::TestCase assert_equal(expected_result, actual_result) end + + + def test_second_parse_redirect_url + v = Veoh.new(nil) + + details_data = nil + + File.open('test/fixtures/veoh/details_data-v15795090Z6mZAbSq.xml') do |f| + details_data = f.read + end + + actual_result = v.send('parse_redirect_url', details_data) + expected_result = 'http://content.veoh.com/flash/f/2/v15795090Z6mZAbSq/3f8044ce2538155c55af5c036cd96ba82a83ddb5.flv?ct=ff4914d2e699e8ad04a69102faaab6ce82b7704998890f69' + + assert_equal(expected_result, actual_result) + end + def test_owns_veoh_urls assert(Veoh.owns_url?('http://www.veoh.com/videos/v801204yMZ8BWcC')) + assert(Veoh.owns_url?('http://www.veoh.com/videos/v15795090Z6mZAbSq')) + assert(Veoh.owns_url?('http://www.veoh.com/group/suggested-anime-w1st-episodes/?source=homepageList#watch%3Dv19961527w773Qq5G')) + assert(Veoh.owns_url?('http://www.veoh.com/browse/videos/category/anime/watch/v19568793XZq2SRzZ')) end end