Sha256: 5243c840b6226c5f7491236a12869b123be31b3ddb55705cb98e4acdd82876a0

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

#!/usr/bin/env ruby 
require 'rubygems'
require 'test/unit'
require File.expand_path(File.dirname(__FILE__) + '/helper')

class ApiKeyTest < Test::Unit::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    
    assert_raise(Fastly::Error) {
      customer = @client.get('/current_customer')
    }
    assert_equal nil, customer
  end
  
  
  def test_current_user_and_customer 
    current_user  = current_customer = nil
    assert_raise(Fastly::Error) {
      current_user = @fastly.current_user
    }
    assert_equal nil, current_user

    assert_raise(Fastly::Error) {
      current_customer = @fastly.current_customer
    }
    assert_equal nil, current_customer    
  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

4 entries across 4 versions & 1 rubygems

Version Path
fastly-0.96 test/api_key_test.rb
fastly-0.95 test/api_key_test.rb
fastly-0.9 test/api_key_test.rb
fastly-0.5 test/api_key_test.rb