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/dailymotion'
23 class DailymotionTest
< Test
::Unit::TestCase
25 def test_owns_dailymotion_urls
26 assert(Dailymotion
.owns_url
?('http://www.dailymotion.com/video/xavgrm_japanese-cosplay-babes_news#hp-v-v8'))
27 assert(Dailymotion
.owns_url
?('http://www.dailymotion.com/video/xavgrm_japanese-cosplay-babes_news'))
28 assert(Dailymotion
.owns_url
?('http://www.dailymotion.com/video/xcuw24_penn-edgar-feature_sport#hp-v-v5'))
29 assert(Dailymotion
.owns_url
?('http://www.dailymotion.com/video/xcuw24_penn-edgar-feature_sport'))
30 assert(Dailymotion
.owns_url
?('http://www.dailymotion.com/video/x241fi_epic-movie-mrs-new-booty'))
34 def test_doesnt_own_infoq_urls
35 assert(!Dailymotion
.owns_url
?('http://www.infoq.com/interviews/jim-weirich-discusses-rake'))
39 def test_doesnt_own_efukt_urls
40 assert(!Dailymotion
.owns_url
?('http://www.efukt.com/2308_How_To_Fuck_Like_A_King.html'))
41 assert(!Dailymotion
.owns_url
?('http://www.efukt.com/2304_The_Dumbest_Porno_Ever_Made.html'))
45 def test_parse_video_url
46 ft
= Dailymotion
.new(nil)
50 File
.open('test/fixtures/dailymotion/ms_new_booty.html') do |f
|
54 test_result
= ft
.send('parse_video_url', page_data
)
55 assert_equal('http://www.dailymotion.com/cdn/FLV-320x240/video/x241fi.flv?auth=1271704672-bc7bb7d6447e816d9247908b89407d3e', test_result
)