Sha256: 9a9484141c4f53d710a8d05a2b0b74ac09fa95352edd07246528a9666c698c61

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'helper'

class ApiKeyTest < Fastly::TestCase
  include CommonTests

  def setup
    @opts = login_opts(:api_key)
    begin
      @client = Fastly::Client.new(@opts)
      @fastly = Fastly.new(@opts)
    rescue Exception => e
      pp e
      exit(-1)
    end
  end

  def test_raw_client
    user = customer = nil
    assert_raise(Fastly::Error) {
      user     = @client.get('/current_user')
    }
    assert_equal nil, user

    customer = @client.get('/current_customer')
    assert customer
    assert_equal @opts[:customer], customer['name']
  end

  def test_current_user_and_customer
    current_user  = current_customer = nil
    assert_raise(Fastly::FullAuthRequired) {
      current_user = @fastly.current_user
    }
    assert_equal nil, current_user

    customer = @fastly.current_customer
    assert customer
    assert_equal @opts[:customer], customer.name
  end

  def test_purging
    #assert @fastly.purge('foo')
    # TODO Won't work until we get fixtures in Heavenly
    #assert @fastly.purge_all('foo')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fastly-1.1.4 test/api_key_test.rb