<commit_before>require File.dirname(__FILE__) + '/../spec_helper'
include BitsOnTheRun

describe Video do
  before(:each) do
    Initializer.run do |config|
      config.api_key    = 'api key'
      config.api_secret = 'api secret'
    end
  end

  after(:each) do
    Configuration.api_key    = nil
    Configuration.api_secret = nil
  end

  describe "Getting a video conversion from the API (/videos/conversions/show)" do
    before(:each) do
      client = Client.new('/some/action')
      client.stub!(:response).and_return REXML::Document.new <<-XML
      <?xml version="1.0" encoding="UTF-8"?>
      <response>
        <status>ok</status>
        <conversion key="<KEY>">
          <filesize>639173</filesize>
          <link>
            <protocol>http</protocol>
            <address>content.bitsontherun.com</address>
            <path>/originals/BvbnBjB6-b6a73a2b.mp4</path>
          </link>
          <status>Ready</status>
          <template id="50" />
        </conversion>
      </response>
      XML
      Client.stub!(:new).and_return(client)
      @conversion = VideoConversion.show("SjwIOMZV")
    end

    it "should return a video conversion instance" do
      @conversion.should be_a(VideoConversion)
    end

    it "should have the conversion key supplied by the API" do
      @conversion.key.should == "<KEY>"
    end

    it "should have the filesize '639173'" do
      @conversion.file_size.should == 639173
    end

    it "should have the template_id '50'" do
      @conversion.template_id.should == 50
    end

  end

  describe "Deleting a video conversion from the API (/videos/conversions/delete)" do
    before(:each) do
      client = Client.new('/some/action')
      client.stub!(:response).and_return REXML::Document.new <<-XML
      <?xml version="1.0" encoding="UTF-8"?>
        <response>
          <status>ok</status>
        </response>
      XML
      Client.stub!(:new).and_return(client)
      @status = VideoConversion.delete!("yYul4DRz")
    end
  
    it "should return status 'ok'" do
      @status.should == "ok"
    end
  
  end
  
end
<commit_msg>add create spec of video conversion<commit_after>require File.dirname(__FILE__) + '/../spec_helper'
include BitsOnTheRun

describe Video do
  before(:each) do
    Initializer.run do |config|
      config.api_key    = 'api key'
      config.api_secret = 'api secret'
    end
  end

  after(:each) do
    Configuration.api_key    = nil
    Configuration.api_secret = nil
  end

  describe "Getting a video conversion from the API (/videos/conversions/show)" do
    before(:each) do
      client = Client.new('/some/action')
      client.stub!(:response).and_return REXML::Document.new <<-XML
      <?xml version="1.0" encoding="UTF-8"?>
      <response>
        <status>ok</status>
        <conversion key="<KEY>">
          <filesize>639173</filesize>
          <link>
            <protocol>http</protocol>
            <address>content.bitsontherun.com</address>
            <path>/originals/BvbnBjB6-b6a73a2b.mp4</path>
          </link>
          <status>Ready</status>
          <template id="50" />
        </conversion>
      </response>
      XML
      Client.stub!(:new).and_return(client)
      @conversion = VideoConversion.show("SjwIOMZV")
    end

    it "should return a video conversion instance" do
      @conversion.should be_a(VideoConversion)
    end

    it "should have the conversion key supplied by the API" do
      @conversion.key.should == "<KEY>"
    end

    it "should have the filesize '639173'" do
      @conversion.file_size.should == 639173
    end

    it "should have the template_id '50'" do
      @conversion.template_id.should == 50
    end

  end

  describe "Deleting a video conversion from the API (/videos/conversions/delete)" do
    before(:each) do
      client = Client.new('/some/action')
      client.stub!(:response).and_return REXML::Document.new <<-XML
      <?xml version="1.0" encoding="UTF-8"?>
        <response>
          <status>ok</status>
        </response>
      XML
      Client.stub!(:new).and_return(client)
      @status = VideoConversion.delete!("yYul4DRz")
    end
  
    it "should return status 'ok'" do
      @status.should == "ok"
    end
  
  end
  
  describe "Creating a video conversion from the API (/videos/conversions/create) " do
    before(:each) do
      client = Client.new('/some/action')
      client.stub!(:response).and_return REXML::Document.new <<-XML
      <?xml version="1.0" encoding="UTF-8"?>
      <response>
        <status>ok</status>
        <conversion key="<KEY>" />
      </response>
      XML
      Client.stub!(:new).and_return(client)
      @conversion = VideoConversion.create!("O7oHKFgm", 50)     
    end
 
    it "should return status 'ok'" do      
      @conversion.should == "ok"
    end
    
  end
  
end

{'fraction_non_alphanumeric': 0.1286100145439435, 'fraction_numerical': 0.0166216496987326, 'mean_word_length': 2.4484240687679084, 'pattern_counts': {'":': 0, '<': 74, '<?xml version=': 5, '>': 64, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '361586', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1506, 'n_words': 352}