Sha256: a6d47c4da921d3ddf0a18ef8e3350d91f626e2d8a6244e1420bc396354269f7f

Contents?: true

Size: 1.92 KB

Versions: 1

Compression:

Stored size: 1.92 KB

Contents

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

describe KewegoParty::Client::Auth do

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

  describe ".auth_get_auth_token" do
    it "should return a token" 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://login.kewego.com/api/getAuthToken/?password=demo&username=test@kewego.com&appToken=#{@client.app_token}").
           to_return(:body => fixture("app_get_auth_token.xml"), :headers => {:content_type => "text/html; charset=utf-8"})

        # @client.app_get_token # Get and save the app_token
        @client.app_token = "d24267bee58313337341f46771f3eeaa64b9254856b0ff3dc6eab18718db0a5e"
        token = @client.auth_get_auth_token(:password => "demo", :username => "test@kewego.com")

        token.should_not be_nil
      end
    end
  end

  describe ".auth_get_login_token" do
    it "should return a token" 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://login.kewego.com/api/getLoginToken/?password=demo&username=test@kewego.com&appToken=#{@client.app_token}").
           to_return(:body => fixture("app_get_auth_token.xml"), :headers => {:content_type => "text/html; charset=utf-8"})

        # @client.app_get_token # Get and save the app_token
        @client.app_token = "d24267bee58313337341f46771f3eeaa64b9254856b0ff3dc6eab18718db0a5e"
        token = @client.auth_get_login_token(:password => "demo", :username => "test@kewego.com")

        token.should_not be_nil
      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/auth_spec.rb