]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - test/veoh_test.rb
Added the ability to download Veoh files.
[dead/whatever-dl.git] / test / veoh_test.rb
diff --git a/test/veoh_test.rb b/test/veoh_test.rb
new file mode 100644 (file)
index 0000000..f104d3a
--- /dev/null
@@ -0,0 +1,33 @@
+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')
+    assert_equal('v801204yMZ8BWcC', video_id)
+  end
+
+  
+  def test_parse_redirect_url
+    v = Veoh.new
+
+    details_data = nil
+
+    File.open('test/fixtures/veoh/details_data-v801204yMZ8BWcC.xml') do |f|
+      details_data = f.read
+    end
+
+    actual_result = v.send('parse_redirect_url', details_data)
+    expected_result = 'http://content.veoh.com/flash/p/801204/7b55b0e3fef09c5599ba2ab3d6a270c3dc9c0a0d.flv?ct=8c18f78c97a2df5cb5f7d849dce97c28996b0835dfc71ce9'
+    
+    assert_equal(expected_result, actual_result)
+  end
+  
+  
+  def test_owns_veoh_urls
+    assert(Veoh.owns_url?('http://www.veoh.com/videos/v801204yMZ8BWcC'))
+  end
+    
+end