test/test_brightcove-api.rb in brightcove-api-1.0.8 vs test/test_brightcove-api.rb in brightcove-api-1.0.9

- old
+ new

@@ -10,11 +10,11 @@ def teardown FakeWeb.allow_net_connect = true end def test_api_version - assert_equal '1.0.8', Brightcove::API::VERSION + assert_equal '1.0.9', Brightcove::API::VERSION end def test_can_set_read_api_url brightcove = Brightcove::API.new('apikeytoken') @@ -122,11 +122,11 @@ brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.') brightcove_response = brightcove.post('delete_video', {:video_id => '595153261337'}) assert brightcove_response.has_key?('result') - assert_equal brightcove_response['error'], 'nil' + assert_equal brightcove_response['error'], nil end def test_create_video_using_post_file FakeWeb.register_uri(:post, 'http://api.brightcove.com/services/post', @@ -134,9 +134,25 @@ :content_type => "application/json") brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.') brightcove_response = brightcove.post_file('create_video', File.join(File.dirname(__FILE__), 'fakeweb', 'movie.mov'), + :video => {:shortDescription => "Short Description", :name => "Video"}) + + assert brightcove_response.has_key?('result') + assert_equal '653155417001', brightcove_response['result'].to_s + assert_equal brightcove_response['error'], nil + end + + def test_create_video_using_post_file_streaming + FakeWeb.register_uri(:post, + 'http://api.brightcove.com/services/post', + :body => File.join(File.dirname(__FILE__), 'fakeweb', 'create_video_response.json'), + :content_type => "application/json") + + brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.') + brightcove_response = brightcove.post_file_streaming('create_video', + File.join(File.dirname(__FILE__), 'fakeweb', 'movie.mov'), 'video/quicktime', :video => {:shortDescription => "Short Description", :name => "Video"}) assert brightcove_response.has_key?('result') assert_equal '653155417001', brightcove_response['result'].to_s assert_equal brightcove_response['error'], nil