]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - test/fuckedtube_test.rb
Added the ability to download FuckedTube (http://www.fuckedtube.com/) videos.
[dead/whatever-dl.git] / test / fuckedtube_test.rb
diff --git a/test/fuckedtube_test.rb b/test/fuckedtube_test.rb
new file mode 100644 (file)
index 0000000..21d4319
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# 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/fuckedtube'
+
+
+class FuckedtubeTest < Test::Unit::TestCase
+
+  def test_owns_fuckedtube_urls
+    assert(Fuckedtube.owns_url?('http://www.fuckedtube.com/video/161/Pumped-Pussy/'))
+    assert(Fuckedtube.owns_url?('http://www.fuckedtube.com/video/152/Hits-From-The-Pong'))
+    assert(Fuckedtube.owns_url?('http://www.fuckedtube.com/video/143/Hot-n-Spicy-Jizz/'))
+    assert(Fuckedtube.owns_url?('http://www.fuckedtube.com/video/4/I-Spy-A-Cervix'))
+  end
+
+  
+  def test_doesnt_own_infoq_urls
+    assert(!Fuckedtube.owns_url?('http://www.infoq.com/interviews/jim-weirich-discusses-rake'))
+  end
+
+  
+  def test_doesnt_own_efukt_urls
+    assert(!Fuckedtube.owns_url?('http://www.efukt.com/2308_How_To_Fuck_Like_A_King.html'))
+    assert(!Fuckedtube.owns_url?('http://www.efukt.com/2304_The_Dumbest_Porno_Ever_Made.html'))
+  end  
+
+  
+  def test_parse_video_url
+    ft = Fuckedtube.new(nil)
+    
+    page_data = nil
+    
+    File.open('test/fixtures/fuckedtube/3.html') do |f|
+      page_data = f.read
+    end
+    
+    test_result = ft.send('parse_video_url', page_data)
+    assert_equal('http://www.fuckedtube.com/videos/br_scan.flv', test_result)
+  end
+
+end