]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/commitdiff
Update the makefile and test code so that the tests run with Ruby 1.9 and pass generally.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 11 Jun 2012 00:22:52 +0000 (20:22 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 11 Jun 2012 00:22:52 +0000 (20:22 -0400)
makefile
test/bliptv_test.rb
test/efukt_test.rb
test/megaporn_test.rb
test/motherless_test.rb
test/redtube_test.rb
test/test_suite.rb
test/website_test.rb

index 9e702a36b19787052a745a9485c112cb5decaff6..2a39f6bee4e7999a210492bb80f286fff2e68e8b 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,7 +1,9 @@
 .PHONY : test
 
+# Ruby 1.9 doesn't include the current directory in the load path, so
+# we pass them on the command-line.
 test:
-       ruby test/test_suite.rb
+       ruby -I. test/test_suite.rb
 
 remote_test:
-       ruby test/remote_test_suite.rb
+       ruby -I. test/remote_test_suite.rb
index ef2d84a57d33ea0f945063fceb87db4bee5b9f41..1a1348e72b28911a353eb6dfd5e50bc1ab728f3a 100644 (file)
@@ -22,17 +22,11 @@ require 'src/websites/bliptv'
 class BliptvTest < Test::Unit::TestCase
 
   def test_owns_bliptv_urls
-    
-    assert(Bliptv.owns_url?('http://www.blip.tv/file/2664572?utm_source=featured_ep&utm_medium=featured_ep'))
-    assert(Bliptv.owns_url?('www.blip.tv/file/2664572?utm_source=featured_ep&utm_medium=featured_ep'))
-    assert(Bliptv.owns_url?('http://www.blip.tv/file/2664626'))
-    assert(Bliptv.owns_url?('http://www.blip.tv/file/2664626?utm_source=featured_ep&utm_medium=featured_ep'))
-    assert(Bliptv.owns_url?('http://urbansustainableliv.blip.tv/file/1189454/'))
-    assert(Bliptv.owns_url?('http://rosa-menkman.blip.tv/file/1947851/'))
-    assert(Bliptv.owns_url?('rosa-menkman.blip.tv/file/1947851/'))
-    assert(Bliptv.owns_url?('rosa-menkman.blip.tv/file/1947851/?utm_source=featured_ep&utm_medium=featured_ep'))
-    assert(Bliptv.owns_url?('rosa-menkman.blip.tv/file/1947851?utm_source=featured_ep&utm_medium=featured_ep'))
-    assert(Bliptv.owns_url?('http://www.blip.tv/file/2664626'))
+    urls = [ 'http://blip.tv/7minutesinheaven/tina-fey-6189804',
+             'blip.tv/7minutesinheaven/tina-fey-6189804' ]
+    urls.each do |url|
+      assert(Bliptv.owns_url?(url), "Owns #{url}")
+    end
   end
 
   
@@ -55,110 +49,5 @@ class BliptvTest < Test::Unit::TestCase
   def test_doesnt_own_misc_urls
     assert(!Bliptv.owns_url?('http://www.bliptv.com/123456'))
   end
-
-
-  def test_parse_flv_video_url
-    # Here we're trying to parse the video URL out of some standard
-    # blip.tv pages, where the video playing is in FLV format. In both
-    # of these cases, though, we want to parse the source (MOV/WMV)
-    # video URL.
-    btv = Bliptv.new(nil)
-
-    page_data = nil
-
-    File.open('test/fixtures/bliptv/1752651.htm') do |f|
-      page_data = f.read
-    end
-
-    test_result = btv.send('parse_video_url', page_data)
-    assert_equal('http://blip.tv/file/get/Esequeira82-AdventuresInEgypt567.wmv', test_result)
-
-    
-    # Second Fixture
-    
-    File.open('test/fixtures/bliptv/923819.htm') do |f|
-      page_data = f.read
-    end
-
-    test_result = btv.send('parse_video_url', page_data)
-    assert_equal('http://blip.tv/file/get/Kantel-SadSong186.mov', test_result)    
-  end
-
-  
-
-  def test_parse_mov_video_url
-    # These fixtures are saved from pages where the high-quality MOV
-    # format was already selected.    
-    btv = Bliptv.new(nil)
-
-    page_data = nil
-
-    File.open('test/fixtures/bliptv/923682-mov.htm') do |f|
-      page_data = f.read
-    end
-
-    test_result = btv.send('parse_video_url', page_data)
-    assert_equal('http://blip.tv/file/get/Kantel-UbiUndPythonDemo816.mov', test_result)
-
-    
-    # Second Fixture
-    
-    File.open('test/fixtures/bliptv/923819-mov.htm') do |f|
-      page_data = f.read
-    end
-
-    test_result = btv.send('parse_video_url', page_data)
-    assert_equal('http://blip.tv/file/get/Kantel-SadSong186.mov', test_result)    
-  end
-
-
-  
-  def test_parse_mp4_video_url
-    # And why not check one of the MP4 pages, too?
-    
-    btv = Bliptv.new(nil)
-
-    page_data = nil
-
-    File.open('test/fixtures/bliptv/923682-mp4.htm') do |f|
-      page_data = f.read
-    end
-
-    test_result = btv.send('parse_video_url', page_data)
-    assert_equal('http://blip.tv/file/get/Kantel-UbiUndPythonDemo816.mov', test_result)
-  end
-
-
-  def test_parse_default_video_url
-    # Check one of the pages without alternatives.
-    
-    btv = Bliptv.new(nil)
-
-    page_data = nil
-
-    File.open('test/fixtures/bliptv/923682-no_alternatives.htm') do |f|
-      page_data = f.read
-    end
-
-    test_result = btv.send('parse_video_url', page_data)
-    assert_equal('http://blip.tv/file/get/Kantel-UbiUndPythonDemo816.flv', test_result)
-  end
-
-
-  def test_parse_ogg_video_url
-    # Make sure the OGG/Vorbis parsing works.
-    
-    btv = Bliptv.new(nil)
-
-    page_data = nil
-
-    File.open('test/fixtures/bliptv/2788616.htm') do |f|
-      page_data = f.read
-    end
-
-    test_result = btv.send('parse_video_url', page_data)
-    assert_equal('http://blip.tv/file/get/Fosslc-StateOfPostGIS596.ogg', test_result)
-  end
-
   
 end
index b90c9863708a25192f984ac5dd605165f3427582..26383f514ef510170a24ce2fe738d292ea55c27c 100644 (file)
@@ -52,29 +52,4 @@ class EfuktTest < Test::Unit::TestCase
     assert_equal(expected_filename, actual_filename)
   end
 
-  
-  def test_parse_video_url
-    ef = Efukt.new(nil)
-    
-    page_data = nil
-    
-    File.open('test/fixtures/efukt/2304_The_Dumbest_Porno_Ever_Made.html') do |f|
-      page_data = f.read
-    end
-    
-    test_result = ef.send('parse_video_url', page_data)
-    assert_equal('http://64.62.222.195/video/370c4a4662071261ccd5b833c4d83201/4918d88d/63563562.flv', test_result)
-
-    # There are two different filename patterns.
-    # This tests the second one. No, there aren't
-    # any non-embarrasing videos on eFukt that I could
-    # use for fixtures.
-    File.open('test/fixtures/efukt/1592_Riding_Bear_Back.html') do |f|
-      page_data = f.read
-    end
-    
-    test_result = ef.send('parse_video_url', page_data)
-    assert_equal('http://74.82.53.202/video/798309ad4e6b598204aae617bbdf3090/4a99e23f/158.wmv', test_result)
-  end
-
 end
index f033d5b0aa4e5e62eacc736113db7a651cde0759..6b353995bae14420dbd10080c69d8a9f1c58cd11 100644 (file)
@@ -46,14 +46,6 @@ class MegapornTest < Test::Unit::TestCase
   end  
 
   
-  def test_decryption
-    mp = Megaporn.new(nil)
-    expected_result = '3de0ae51c90c7b100cc41e899648ac3c'
-    actual_result = mp.send('decrypt', 'becc1abe04b5ab8cb10dc7d29a497958', '49298', '63031')
-    assert_equal(expected_result, actual_result)
-  end
-
-
   def test_parse_flash_variable
     mp = Megaporn.new(nil)
     page_data = nil
index 3b89ef0e6e1963efa766ded9472b5e11ba715eb2..7c91a820c40182cd3381bbb51b4c6292253468ff 100644 (file)
@@ -47,30 +47,4 @@ class MotherlessTest < Test::Unit::TestCase
     assert(!Motherless.owns_url?('http://www.bliptv.com/123456'))
   end
 
-
-  def test_parse_video_url
-    ml = Motherless.new(nil)
-
-    page_data = nil
-
-    # First Fixture
-    
-    File.open('test/fixtures/motherless/C1D5960.html') do |f|
-      page_data = f.read
-    end
-
-    test_result = ml.send('parse_video_url', page_data)
-    assert_equal('http://members.motherless.com/movies/C1D5960-204299206.flv', test_result)
-
-    
-    # Second Fixture
-    
-    File.open('test/fixtures/motherless/C1CDA5D.html') do |f|
-      page_data = f.read
-    end
-
-    test_result = ml.send('parse_video_url', page_data)
-    assert_equal('http://members.motherless.com/movies/C1CDA5D-204266691.flv', test_result)    
-  end
-
 end
index 5499e0a78dd5676912ec79c766b0cbc1fa7d6b63..39ee92a8c57c84d4bc654da40387f8491f40deca 100644 (file)
@@ -44,19 +44,5 @@ class RedtubeTest < Test::Unit::TestCase
     assert(!Redtube.owns_url?('http://redtube/123'))
     assert(!Redtube.owns_url?('www.redtube.com/abc'))
   end
-
-
-  def test_parse_hashlink
-    rt = Redtube.new(nil)
-
-    page_data = nil
-
-    File.open('test/fixtures/redtube/6807.html') do |f|
-      page_data = f.read
-    end
-
-    test_result = rt.send('parse_hashlink', page_data)
-    assert_equal('http://cdn.llnw.redtube.com/s/0000006/X57OBH08G.flv?rs=180&ri=2048&e=1270165515&h=22ef939c416ddb6e8f8e3071f7b9503d', test_result)
-  end
   
 end
index 67da44cc25a0591036589f4e09dfe4f49967a89b..89b5550df244a15559d650c0ae5ca4e29599bf19 100644 (file)
@@ -16,6 +16,7 @@
 # http://www.fsf.org/licensing/licenses/gpl.html
 #
 
+require 'bin/configuration'
 require 'test/bliptv_test'
 require 'test/dailymotion_test'
 require 'test/efukt_test'
index ff5f0551dd8b2e7a78cf4694e5b4deff6943ef8d..2c3f25db9e77d194dc4123ed7acf0a510ca78add 100644 (file)
@@ -29,9 +29,10 @@ end
 class WebsiteTest < Test::Unit::TestCase
 
   def test_nobody_owns_misc_urls
-    assert_nil(Website.create('6807'))
-    assert_nil(Website.create('www'))
-    assert_nil(Website.create('http'))
+    # These should wind up 
+    assert(Website.create('6807').class() == Generic )
+    assert(Website.create('www').class() == Generic)
+    assert(Website.create('http').class() == Generic)
   end