<commit_before>require_relative '../../spec_helper'
require_relative '../../support/dummy_dropbox'
require_relative '../../../lib/dropdown/dropbox/session'

describe Dropdown::Dropbox::Session do
  subject { Dropdown::Dropbox::Session.new 'key', 'secret' }

  describe '#authorize_url' do
    it 'returns the url for the user to authorize Dropbox' do
      subject.authorize_url.should == 'https://www.dropbox.com/1/oauth2/authorize?client_id=key&response_type=code'
    end
  end

  describe '#access_token' do
    include DummyDropbox

    it 'returns the access token based on the authorize code' do
      access_token = "<PASSWORD>"

      stub_dropbox_token 'key', 'secret', access_token
      subject.access_token('blah').should == access_token
    end
  end
end<commit_msg>Refactor spec to remove duplication of hard coded strings<commit_after>require_relative '../../spec_helper'
require_relative '../../support/dummy_dropbox'
require_relative '../../../lib/dropdown/dropbox/session'

describe Dropdown::Dropbox::Session do
  let(:app_key) { 'key' }
  let(:app_secret) { 'secret' }
  subject { Dropdown::Dropbox::Session.new app_key, app_secret }

  describe '#authorize_url' do
    it 'returns the url for the user to authorize Dropbox' do
      subject.authorize_url.should == "https://www.dropbox.com/1/oauth2/authorize?client_id=#{app_key}&response_type=code"
    end
  end

  describe '#access_token' do
    include DummyDropbox

    it 'returns the access token based on the authorize code' do
      access_token = "1<PASSWORD>"

      stub_dropbox_token app_key, app_secret, access_token
      subject.access_token('blah').should == access_token
    end
  end
end
{'fraction_non_alphanumeric': 0.12097735399284863, 'fraction_numerical': 0.0029797377830750892, 'mean_word_length': 3.9821958456973294, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '1351181', 'n_tokens_mistral': 520, 'n_tokens_neox': 511, 'n_words': 127}