--- /dev/null
+#
+# 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/dailymotion'
+
+
+class DailymotionTest < Test::Unit::TestCase
+
+ def test_owns_dailymotion_urls
+ assert(Dailymotion.owns_url?('http://www.dailymotion.com/video/xavgrm_japanese-cosplay-babes_news#hp-v-v8'))
+ assert(Dailymotion.owns_url?('http://www.dailymotion.com/video/xavgrm_japanese-cosplay-babes_news'))
+ assert(Dailymotion.owns_url?('http://www.dailymotion.com/video/xcuw24_penn-edgar-feature_sport#hp-v-v5'))
+ assert(Dailymotion.owns_url?('http://www.dailymotion.com/video/xcuw24_penn-edgar-feature_sport'))
+ assert(Dailymotion.owns_url?('http://www.dailymotion.com/video/x241fi_epic-movie-mrs-new-booty'))
+ end
+
+
+ def test_doesnt_own_infoq_urls
+ assert(!Dailymotion.owns_url?('http://www.infoq.com/interviews/jim-weirich-discusses-rake'))
+ end
+
+
+ def test_doesnt_own_efukt_urls
+ assert(!Dailymotion.owns_url?('http://www.efukt.com/2308_How_To_Fuck_Like_A_King.html'))
+ assert(!Dailymotion.owns_url?('http://www.efukt.com/2304_The_Dumbest_Porno_Ever_Made.html'))
+ end
+
+
+ def test_parse_video_url
+ ft = Dailymotion.new(nil)
+
+ page_data = nil
+
+ File.open('test/fixtures/dailymotion/ms_new_booty.html') do |f|
+ page_data = f.read
+ end
+
+ test_result = ft.send('parse_video_url', page_data)
+ assert_equal('http://www.dailymotion.com/cdn/FLV-320x240/video/x241fi.flv?auth=1271704672-bc7bb7d6447e816d9247908b89407d3e', test_result)
+ end
+
+end