Sha256: 13f5369fb9721823cc6ec463b611880affc8bc174c003536bda1b53558c4aaad

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

require './spec/spec_helper'

describe SparkApi::Authentication do
  it "should give me a session object" do
    stub_auth_request
    stub_request(:get, "#{SparkApi.endpoint}/#{SparkApi.version}/session/c401736bf3d3f754f07c04e460e09573").
      with(:query => {
        :ApiSig => "d4cea51b4a6b9eb930e4320866aae7d0",
        :ApiUser => "foobar",
        :AuthToken => "c401736bf3d3f754f07c04e460e09573"
      }).
      to_return(:body => fixture("session.json"))
    client = SparkApi.client
    stub_auth_request
    session = client.get "/session/c401736bf3d3f754f07c04e460e09573"
    expect(session[0]["AuthToken"]).to eq("c401736bf3d3f754f07c04e460e09573")
  end
  it "should delete a session" do
    stub_auth_request
    stub_request(:delete, "#{SparkApi.endpoint}/#{SparkApi.version}/session/c401736bf3d3f754f07c04e460e09573").
      with(:query => {
        :ApiSig => "d4cea51b4a6b9eb930e4320866aae7d0",
        :ApiUser => "foobar",
        :AuthToken => "c401736bf3d3f754f07c04e460e09573"
      }).
      to_return(:body => fixture("success.json"))
    client = SparkApi.client
    client.logout
    expect(client.session).to eq(nil)
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spark_api-1.6.3 spec/unit/spark_api/authentication_spec.rb
spark_api-1.6.2 spec/unit/spark_api/authentication_spec.rb
spark_api-1.6.1 spec/unit/spark_api/authentication_spec.rb
spark_api-1.5.7 spec/unit/spark_api/authentication_spec.rb
spark_api-1.6.0 spec/unit/spark_api/authentication_spec.rb
spark_api-1.5.6 spec/unit/spark_api/authentication_spec.rb
spark_api-1.5.5 spec/unit/spark_api/authentication_spec.rb
spark_api-1.5.4 spec/unit/spark_api/authentication_spec.rb
spark_api-1.5.3 spec/unit/spark_api/authentication_spec.rb
spark_api-1.5.2 spec/unit/spark_api/authentication_spec.rb
spark_api-1.5.1 spec/unit/spark_api/authentication_spec.rb
spark_api-1.5.0 spec/unit/spark_api/authentication_spec.rb