Sha256: 1e3659426c1eb4356e4ce328b861a2d4d22baa2ae168cacbde714859796ac48d

Contents?: true

Size: 1.84 KB

Versions: 7

Compression:

Stored size: 1.84 KB

Contents

require 'test_helper'
require 'epom/zone'

class ZoneTest < ActiveSupport::TestCase
	test "truth" do
    assert_kind_of Class, Epom::Zone
  end

  test "create_zone" do
    timestamp = Time.now.to_i * 1000
    body_params = {
      :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
      :timestamp => timestamp, 
      :username => ENV['username'],
      :name => "zone #{timestamp}",
      :description => "description",
      :siteId => ENV['site_id']
    }
    url_params = {
    }

    response = Epom::Zone.create_zone(url_params, body_params)
    assert_instance_of Hash, response
    assert_instance_of Fixnum, response['id']
    assert response['success']
  end

  test "update_zone" do
    timestamp = Time.now.to_i * 1000
    body_params = {
      :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
      :timestamp => timestamp, 
      :username => ENV['username'],
      :name => "zone #{timestamp}",
      :description => "description",
      :zoneId => ENV['zone_id'],
      :siteId => ENV['site_id'] 
    }
    url_params = {
    }

    response = Epom::Zone.update_zone(url_params, body_params)
    assert_instance_of Hash, response
    assert_instance_of Fixnum, response['id']
    assert response['success']
  end

  test "get_zone_placements" do
    timestamp = Time.now.to_i * 1000
    body_params = {
      :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
      :timestamp => timestamp, 
      :username => ENV['username'],
    }
    url_params = {
    	:zoneId => ENV['zone_id']
    }

    response = Epom::Zone.get_zone_placements(url_params.merge(body_params))
    assert_instance_of Array, response
    if response.count > 0
    	first = response[0]
    	assert_instance_of Fixnum, first['id']
    	assert_instance_of String, first['name']
    end
  end

  define_get_tests_auto(Epom::Zone)
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
epom-0.10.11 test/epom/zone_test.rb
epom-0.10.10 test/epom/zone_test.rb
epom-0.10.9 test/epom/zone_test.rb
epom-0.10.8 test/epom/zone_test.rb
epom-0.10.7 test/epom/zone_test.rb
epom-0.10.5 test/epom/zone_test.rb
epom-0.10 test/epom/zone_test.rb