Sha256: 842727a175fd9a60183d70330e51cffd797e3b063454e0f397cff4538d0b3c16

Contents?: true

Size: 1.19 KB

Versions: 37

Compression:

Stored size: 1.19 KB

Contents

require 'helper'

# Admin-related tests
class AdminTest < Fastly::TestCase
  def setup
    opts = login_opts(:full)
    begin
      @client = Fastly::Client.new(opts)
      @fastly = Fastly.new(opts)
    rescue => e
      warn e.inspect
      warn e.backtrace.join("\n")
      exit(-1)
    end
  end

  def test_creating_and_updating_customer
    return unless @fastly.current_user.can_do?(:admin)
    customer = @fastly.create_customer(:name => "fastly-ruby-test-customer-#{random_string}")
    email    = "fastly-ruby-test-#{random_string}-new@example.com"
    user     = @fastly.create_user(:login => email, :name => 'New User')
    customer.owner_id = user.id

    tmp = @fastly.update_customer(customer)
    assert tmp
    assert_equal customer.id, tmp.id
    assert_equal customer.owner.id, tmp.owner.id
  end

  def test_creating_and_updating_customer_with_owner
    return unless @fastly.current_user.can_do?(:admin)
    email    = "fastly-ruby-test-#{random_string}-new@example.com"
    customer = @fastly.create_customer(:name => "fastly-ruby-test-customer-#{random_string}", :owner => { :login => email, :name => 'Test NewOwner' })
    assert customer
    assert_equal customer.owner.login, email
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
fastly-1.10.0 test/admin_test.rb
fastly-1.9.0 test/admin_test.rb
fastly-1.8.0 test/admin_test.rb
fastly-1.7.0 test/admin_test.rb
fastly-1.6.1 test/admin_test.rb
fastly-1.6.0 test/admin_test.rb
fastly-1.5.0 test/admin_test.rb
fastly-1.4.3 test/admin_test.rb
fastly-1.4.2 test/admin_test.rb
fastly-1.4.1 test/admin_test.rb
fastly-1.4.0 test/admin_test.rb
fastly-1.3.0 test/admin_test.rb
fastly-1.2.3 test/admin_test.rb
fastly-1.2.2 test/admin_test.rb
fastly-1.2.1 test/admin_test.rb
fastly-1.2.0 test/admin_test.rb
fastly-1.1.5 test/admin_test.rb