Sha256: a25f38212b61b0a12e36b9759c7a124762808297e39d407b425e9f69a5ecb15f

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# -*- encoding: utf-8 -*-
require 'spec_helper'

describe KewegoParty::Client::Video do

  before do
    @client = KewegoParty::Client.new(:token => 'd4c804fd0f42533351aca404313d26eb')

    @upload_key = "9c4f35567be7fda1e143d95696fadb1a" # Digest::MD5.hexdigest(SecureRandom.hex(15))
  end

  describe ".upload_get_available_categories" do
    use_vcr_cassette "upload_get_available_categories"

    it "should return the upload categories" do
      @client.app_get_token # Get and save the app_token
      categories = @client.upload_get_available_categories

      categories.should have_at_least(2).items
    end
  end

  describe ".upload_get_upload_progress" do
    it "should return the progress of an upload" do
      VCR.turned_off do
        stub_request(:get, "http://api.kewego.com/app/getToken/?appKey=#{@client.token}").
            to_return(:body => fixture("app_get_token.xml"), :headers => {:content_type => "text/html; charset=utf-8"})

        stub_request(:get, "http://api.kewego.com/upload/getUploadProgress/?appToken=#{@client.app_token}&upload_key=#{@upload_key}").
           to_return(:body => fixture("upload_get_upload_progress.xml"), :headers => {:content_type => "text/html; charset=utf-8"})

        @client.app_get_token # Get and save the app_token
        stats = @client.upload_get_upload_progress(@upload_key)

        stats.state.should == 'uploading'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kewego_party-0.0.1 spec/kewego_party/client/upload_spec.rb