Sha256: c57c5624252437043157637c4cbb50576c4a3990b8459dba8945061808e9b51b

Contents?: true

Size: 986 Bytes

Versions: 2

Compression:

Stored size: 986 Bytes

Contents

require 'spec_helper'

describe Elastic::SiteSearch::SSO do
  let(:user_id) { '5064a7de2ed960e715000276' }
  let(:timestamp) { 1379382520 }
  before :each do
    Elastic::SiteSearch.platform_client_id = '3e4fd842fc99aecb4dc50e5b88a186c1e206ddd516cdd336da3622c4afd7e2e9'
    Elastic::SiteSearch.platform_client_secret = '4441879b5e2a9c3271f5b1a4bc223b715f091e5ed20fe75d1352e1290c7a6dfb'

    allow_any_instance_of(Time).to receive(:to_i).and_return(timestamp)
  end

  context '.token' do
    it 'generates an SSO token' do
      expect(Elastic::SiteSearch::SSO.token(user_id, timestamp)).to eq('81033d182ad51f231cc9cda9fb24f2298a411437')
    end
  end

  context '.url' do
    it 'generates an SSO URL' do
      expect(Elastic::SiteSearch::SSO.url(user_id)).to eq('https://swiftype.com/sso?user_id=5064a7de2ed960e715000276&client_id=3e4fd842fc99aecb4dc50e5b88a186c1e206ddd516cdd336da3622c4afd7e2e9&timestamp=1379382520&token=81033d182ad51f231cc9cda9fb24f2298a411437')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elastic-site-search-2.1.0 spec/sso_spec.rb
elastic-site-search-2.0.0 spec/sso_spec.rb