Sha256: 0dd07d4307d5158367bb5082ba7cd9a1488ff819ba0a67624709d4386bb4291c
Contents?: true
Size: 1.94 KB
Versions: 1
Compression:
Stored size: 1.94 KB
Contents
class TestNetwork < TestYaoResource def test_network # https://docs.openstack.org/api-ref/network/v2/#networks params = { "admin_state_up" => true, "id" => "b3680498-03da-4691-896f-ef9ee1d856a7", "name" => "net1", "provider:network_type" => "vlan", "provider:physical_network" => "physnet1", "provider:segmentation_id" => 1000, "router:external" => false, "shared" => false, "status" => "ACTIVE", "subnets" => [], "tenant_id" => "c05140b3dc7c4555afff9fab6b58edc2", "project_id" => "c05140b3dc7c4555afff9fab6b58edc2", } network = Yao::Network.new(params) # friendly_attributes assert_equal(network.id, "b3680498-03da-4691-896f-ef9ee1d856a7") assert_equal(network.name, "net1") assert_equal(network.status, "ACTIVE") assert_equal(network.shared, false) assert_equal(network.shared?, false) assert_equal(network.tenant_id, "c05140b3dc7c4555afff9fab6b58edc2") assert_equal(network.subnets, []) assert_equal(network.admin_state_up, true) #map_attribute_to_attribute assert_equal(network.physical_network, "physnet1") assert_equal(network.type, "vlan") assert_equal(network.segmentation_id, 1000) end def test_tenant stub = stub_request(:get, "https://example.com:12345/tenants/0123456789abcdef0123456789abcdef") .to_return( status: 200, body: <<-JSON, { "tenant": { "id": "0123456789abcdef0123456789abcdef" } } JSON headers: {'Content-Type' => 'application/json'} ) network = Yao::Network.new( "project_id" => "0123456789abcdef0123456789abcdef", "tenant_id" => "0123456789abcdef0123456789abcdef", ) assert_instance_of(Yao::Tenant, network.tenant) assert_instance_of(Yao::Tenant, network.project) assert_equal(network.tenant.id, '0123456789abcdef0123456789abcdef') assert_requested(stub) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yao-0.8.0 | test/yao/resources/test_network.rb |