require File.dirname(__FILE__) + '/test_helper.rb' class ViddlerTest < Test::Unit::TestCase TEST_VIDEO_FILE_PATH = File.join(File.dirname(__FILE__),'uploadable.mp4') def setup # @viddler = Viddler::Base.new('000000000000000000000000000000000000000000', 'test', 'test') end def test_should_authenticate # @viddler.authenticate # assert @viddler.authenticated? true end def test_should_get_record_token # token = @viddler.get_record_token # assert_kind_of String, token true end def test_should_upload_video # file = File.open(TEST_VIDEO_FILE_PATH) # video = @viddler.upload_video(:file => file, :title => 'Testing', :description => 'Bla', :tags => 'one, two, three', :make_public => '1') true end def test_should_find_profile # user = @viddler.find_profile('ilya') # assert_kind_of Viddler::User, user true end def test_should_update_profile # user = @viddler.update_profile(:first_name => 'TEST', # :last_name => 'TEST', # :about_me => 'TEST', # :gender => 'm', # :company => 'TEST', # :city => 'TEST') # assert_kind_of Viddler::User, user true end def test_should_update_account # assert @viddler.update_account(:show_account => '0') true end =begin def test_should_get_video_status assert @viddler.get_video_status('6b0b9af1') end =end def test_should_find_video_by_id # video = @viddler.find_video_by_id('6b0b9af1') # assert_kind_of Viddler::Video, video true end def test_should_get_dimensions # video = @viddler.find_video_by_id('6b0b9af1') # assert_equal 640, video.width # assert_equal 360, video.height true end def test_should_find_video_by_url # video = @viddler.find_video_by_url('http://www.viddler.com/explore/ijustine/videos/293/') # assert_kind_of Viddler::Video, video true end def test_should_find_all_videos_by_user # videos = @viddler.find_all_videos_by_user('ijustine') # assert_kind_of Viddler::Video, videos.first true end def test_should_find_all_videos_by_tag # videos = @viddler.find_all_videos_by_tag('hot') # assert_kind_of Viddler::Video, videos.first true end def test_should_find_all_features_videos # videos = @viddler.find_all_featured_videos # assert_kind_of Viddler::Video, videos.first true end end