misty 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +23 -23
- data/lib/misty/auth.rb +24 -19
- data/lib/misty/auth/auth_v2.rb +12 -12
- data/lib/misty/auth/auth_v3.rb +15 -15
- data/lib/misty/autoload.rb +27 -27
- data/lib/misty/cloud.rb +2 -1
- data/lib/misty/http/client.rb +17 -15
- data/lib/misty/http/method_builder.rb +1 -1
- data/lib/misty/http/net_http.rb +12 -7
- data/lib/misty/http/request.rb +13 -7
- data/lib/misty/misty.rb +30 -30
- data/lib/misty/openstack/aodh/v2.rb +1 -1
- data/lib/misty/openstack/ceilometer/v2.rb +1 -1
- data/lib/misty/openstack/cinder/v1.rb +2 -2
- data/lib/misty/openstack/cinder/v2.rb +2 -2
- data/lib/misty/openstack/cinder/v3.rb +2 -2
- data/lib/misty/openstack/designate/v2.rb +1 -1
- data/lib/misty/openstack/freezer/v1.rb +1 -1
- data/lib/misty/openstack/glance/v1.rb +1 -1
- data/lib/misty/openstack/glance/v2.rb +1 -1
- data/lib/misty/openstack/heat/v1.rb +2 -2
- data/lib/misty/openstack/ironic/v1.rb +2 -2
- data/lib/misty/openstack/karbor/v1.rb +1 -1
- data/lib/misty/openstack/keystone/v2_0.rb +2 -2
- data/lib/misty/openstack/keystone/v3.rb +2 -2
- data/lib/misty/openstack/magnum/v1.rb +2 -2
- data/lib/misty/openstack/manila/v2.rb +2 -2
- data/lib/misty/openstack/microversion.rb +9 -9
- data/lib/misty/openstack/murano/v1.rb +1 -1
- data/lib/misty/openstack/neutron/v2_0.rb +1 -1
- data/lib/misty/openstack/nova/v2_1.rb +4 -4
- data/lib/misty/openstack/octavia/v2_0.rb +1 -1
- data/lib/misty/openstack/sahara/v1_1.rb +1 -1
- data/lib/misty/openstack/searchlight/v1.rb +1 -1
- data/lib/misty/openstack/senlin/v1.rb +1 -1
- data/lib/misty/openstack/swift/v1.rb +1 -1
- data/lib/misty/openstack/tacker/v1_0.rb +1 -1
- data/lib/misty/openstack/trove/v1_0.rb +1 -1
- data/lib/misty/openstack/zaqar/v2.rb +1 -1
- data/lib/misty/services.rb +1 -1
- data/lib/misty/version.rb +1 -1
- data/test/integration/compute_test.rb +17 -17
- data/test/integration/network_test.rb +16 -16
- data/test/integration/orchestration_test.rb +51 -51
- data/test/integration/test_helper.rb +7 -7
- data/test/unit/auth/name_test.rb +53 -53
- data/test/unit/auth_test.rb +151 -152
- data/test/unit/cloud/requests_test.rb +58 -58
- data/test/unit/cloud/services_test.rb +62 -62
- data/test/unit/cloud_test.rb +48 -48
- data/test/unit/http/client_test.rb +21 -28
- data/test/unit/http/direct_test.rb +31 -31
- data/test/unit/http/method_builder_test.rb +42 -42
- data/test/unit/http/request_test.rb +33 -33
- data/test/unit/misty_test.rb +28 -28
- data/test/unit/openstack/APIs_test.rb +3 -3
- data/test/unit/openstack/microversion_test.rb +14 -14
- data/test/unit/service_helper.rb +4 -4
- data/test/unit/services_test.rb +5 -5
- data/test/unit/test_helper.rb +1 -1
- metadata +4 -4
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'misty/http/client'
|
2
2
|
require 'misty/openstack/microversion'
|
3
|
-
require
|
3
|
+
require 'misty/openstack/nova/nova_v2_1'
|
4
4
|
|
5
5
|
module Misty
|
6
6
|
module Openstack
|
@@ -15,7 +15,7 @@ module Misty
|
|
15
15
|
|
16
16
|
# Overrides API because the definitions don't specify prefix
|
17
17
|
def self.list_all_major_versions
|
18
|
-
http_get(
|
18
|
+
http_get('/', headers)
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.show_details_of_specific_api_version(version)
|
@@ -29,9 +29,9 @@ module Misty
|
|
29
29
|
def microversion_header
|
30
30
|
{
|
31
31
|
# Remove once depcrecated
|
32
|
-
|
32
|
+
'X-Openstack-Nova-API-Version' => "#{@version}",
|
33
33
|
# From version 2.27 the OpenStack-API-Version is used
|
34
|
-
|
34
|
+
'X-Openstack-API-Version' => "#{baseclass.downcase} #{@version}"
|
35
35
|
}
|
36
36
|
end
|
37
37
|
end
|
data/lib/misty/services.rb
CHANGED
data/lib/misty/version.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
it
|
5
|
-
VCR.use_cassette
|
6
|
-
cloud = Misty::Cloud.new(:auth => auth, :compute => {:api_version =>
|
3
|
+
describe 'Compute Service Nova v2.1 features' do
|
4
|
+
it 'GET/POST/PUT/DELETE requests' do
|
5
|
+
VCR.use_cassette 'compute using nova v2.1' do
|
6
|
+
cloud = Misty::Cloud.new(:auth => auth, :compute => {:api_version => 'v2.1'})
|
7
7
|
|
8
8
|
# POST with body data
|
9
|
-
server = {
|
10
|
-
response = cloud.compute.create_server(
|
11
|
-
response.code.must_equal
|
12
|
-
id = response.body[
|
9
|
+
server = { 'name': 'test_create_server', 'flavorRef': '1', 'imageRef': 'c091ccf2-a4ae-4fa0-a716-defd6376b5dc', 'networks': [{'uuid': '9c6e43b6-3d1d-4106-ad45-5fc3f5e371ee'}]}
|
10
|
+
response = cloud.compute.create_server('server' => server)
|
11
|
+
response.code.must_equal '202'
|
12
|
+
id = response.body['server']['id']
|
13
13
|
id.wont_be_empty
|
14
14
|
|
15
15
|
# GET
|
16
16
|
response = cloud.compute.list_servers
|
17
|
-
response.code.must_equal
|
18
|
-
response.body[
|
17
|
+
response.code.must_equal '200'
|
18
|
+
response.body['servers'].size.must_equal 2
|
19
19
|
|
20
20
|
# GET with URI value
|
21
21
|
response = cloud.compute.show_server_details(id)
|
22
|
-
response.code.must_equal
|
23
|
-
response.body[
|
22
|
+
response.code.must_equal '200'
|
23
|
+
response.body['server']['name'].must_equal 'test_create_server'
|
24
24
|
|
25
25
|
# PUT with URI value and body data
|
26
|
-
update_server = {
|
27
|
-
response = cloud.compute.update_server(id,
|
28
|
-
response.code.must_equal
|
29
|
-
response.body[
|
26
|
+
update_server = { 'name': 'test_updated_server' }
|
27
|
+
response = cloud.compute.update_server(id, 'server' => update_server)
|
28
|
+
response.code.must_equal '200'
|
29
|
+
response.body['server']['name'].must_equal 'test_updated_server'
|
30
30
|
|
31
31
|
# DELETE with URI value
|
32
|
-
cloud.compute.delete_server(id).code.must_equal
|
32
|
+
cloud.compute.delete_server(id).code.must_equal '204'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -1,34 +1,34 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
it
|
5
|
-
VCR.use_cassette
|
6
|
-
cloud = Misty::Cloud.new(:auth => auth, :network => {:api_version =>
|
3
|
+
describe 'Network Service Neutron v2.0 features' do
|
4
|
+
it 'GET/POST/PUT/DELETE requests' do
|
5
|
+
VCR.use_cassette 'network using neutron v2.0' do
|
6
|
+
cloud = Misty::Cloud.new(:auth => auth, :network => {:api_version => 'v2.0'})
|
7
7
|
|
8
8
|
# POST with body data
|
9
|
-
response = cloud.network.create_network(
|
10
|
-
response.code.must_equal
|
11
|
-
id = response.body[
|
9
|
+
response = cloud.network.create_network('network' => { 'name': 'test_network' })
|
10
|
+
response.code.must_equal '201'
|
11
|
+
id = response.body['network']['id']
|
12
12
|
id.wont_be_empty
|
13
13
|
|
14
14
|
# GET
|
15
15
|
response = cloud.network.list_networks
|
16
|
-
response.code.must_equal
|
17
|
-
response.body[
|
16
|
+
response.code.must_equal '200'
|
17
|
+
response.body['networks'].size.must_equal 3
|
18
18
|
|
19
19
|
# GET with URI value
|
20
20
|
response = cloud.network.show_network_details(id)
|
21
|
-
response.code.must_equal
|
22
|
-
response.body[
|
21
|
+
response.code.must_equal '200'
|
22
|
+
response.body['network']['name'].must_equal 'test_network'
|
23
23
|
|
24
24
|
# PUT with URI value and body data
|
25
|
-
update_network = {
|
26
|
-
response = cloud.network.update_network(id,
|
27
|
-
response.code.must_equal
|
28
|
-
response.body[
|
25
|
+
update_network = { 'name': 'test_updated_network' }
|
26
|
+
response = cloud.network.update_network(id, 'network' => update_network)
|
27
|
+
response.code.must_equal '200'
|
28
|
+
response.body['network']['name'].must_equal 'test_updated_network'
|
29
29
|
|
30
30
|
# DELETE with URI value
|
31
|
-
cloud.network.delete_network(id).code.must_equal
|
31
|
+
cloud.network.delete_network(id).code.must_equal '204'
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -1,92 +1,92 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
heat_template1 = {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
'files': {},
|
5
|
+
'disable_rollback': true,
|
6
|
+
'stack_name': 'test_stack1',
|
7
|
+
'template': {
|
8
|
+
'heat_template_version': '2013-05-23',
|
9
|
+
'description': 'Test Template 1',
|
10
|
+
'resources': {
|
11
|
+
'private_test_network': {
|
12
|
+
'type': 'OS::Neutron::Net',
|
13
|
+
'properties': { 'name': 'heat_test_network' }
|
14
14
|
}
|
15
15
|
}
|
16
16
|
},
|
17
|
-
|
17
|
+
'timeout_mins': 60
|
18
18
|
}
|
19
19
|
|
20
20
|
heat_template2 = {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
'files': {},
|
22
|
+
'disable_rollback': true,
|
23
|
+
'parameters': {
|
24
|
+
'flavor': 'm1.tiny'
|
25
25
|
},
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
'stack_name': 'test_stack2',
|
27
|
+
'template': {
|
28
|
+
'heat_template_version': '2013-05-23',
|
29
|
+
'description': 'Test Template 2',
|
30
|
+
'parameters': {
|
31
|
+
'flavor': {
|
32
|
+
'default': 'm1.small',
|
33
|
+
'type': 'string'
|
34
34
|
}
|
35
35
|
},
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
'resources': {
|
37
|
+
'hello_world': {
|
38
|
+
'type': 'OS::Nova::Server',
|
39
|
+
'properties': {
|
40
|
+
'flavor': { 'get_param': 'flavor' },
|
41
|
+
'image': '50fd6f2b-d9f0-41b6-b0a9-4482bfe61914',
|
42
|
+
'user_data': '#!/bin/bash -xv\necho \'hello world\' > /root/hello-world.txt\n'
|
43
43
|
}
|
44
44
|
}
|
45
45
|
}
|
46
46
|
},
|
47
|
-
|
47
|
+
'timeout_mins': 60
|
48
48
|
}
|
49
49
|
|
50
|
-
describe
|
51
|
-
it
|
52
|
-
VCR.use_cassette
|
53
|
-
cloud = Misty::Cloud.new(:auth => auth, :orchestration => {:api_version =>
|
50
|
+
describe 'Orchestration Service using Heat v1' do
|
51
|
+
it 'GET/POST/PUT/DELETE requests' do
|
52
|
+
VCR.use_cassette 'orchestration using heat v1' do
|
53
|
+
cloud = Misty::Cloud.new(:auth => auth, :orchestration => {:api_version => 'v1'})
|
54
54
|
|
55
55
|
# POST with body data
|
56
56
|
response = cloud.orchestration.create_stack(heat_template1)
|
57
|
-
response.code.must_equal
|
58
|
-
id1 = response.body[
|
57
|
+
response.code.must_equal '201'
|
58
|
+
id1 = response.body['stack']['id']
|
59
59
|
id1.wont_be_empty
|
60
60
|
|
61
61
|
response = cloud.orchestration.create_stack(heat_template2)
|
62
|
-
response.code.must_equal
|
63
|
-
id2 = response.body[
|
62
|
+
response.code.must_equal '201'
|
63
|
+
id2 = response.body['stack']['id']
|
64
64
|
id2.wont_be_empty
|
65
65
|
|
66
66
|
# GET
|
67
67
|
response = cloud.orchestration.list_stacks
|
68
|
-
response.code.must_equal
|
69
|
-
response.body[
|
68
|
+
response.code.must_equal '200'
|
69
|
+
response.body['stacks'].size.must_equal 2
|
70
70
|
|
71
71
|
# GET with URI value
|
72
|
-
response = cloud.orchestration.show_stack_details(
|
73
|
-
response.code.must_equal
|
74
|
-
response.body[
|
72
|
+
response = cloud.orchestration.show_stack_details('test_stack2', id2)
|
73
|
+
response.code.must_equal '200'
|
74
|
+
response.body['stack']['stack_name'].must_equal 'test_stack2'
|
75
75
|
|
76
76
|
# PUT with URI value and body data
|
77
77
|
# Updating the network template because it's faster to execute
|
78
78
|
# therefore more likely to be in ready state before updating
|
79
|
-
heat_template1[:template][:description] =
|
80
|
-
response = cloud.orchestration.update_stack(
|
81
|
-
response.code.must_equal
|
79
|
+
heat_template1[:template][:description] = 'Updated test template'
|
80
|
+
response = cloud.orchestration.update_stack('test_stack1', id1, heat_template1)
|
81
|
+
response.code.must_equal '202'
|
82
82
|
|
83
83
|
# PATCH with URI values
|
84
|
-
response = cloud.orchestration.update_stack_patch(
|
85
|
-
response.code.must_equal
|
84
|
+
response = cloud.orchestration.update_stack_patch('test_stack1', id1, 'disable_rollback': false)
|
85
|
+
response.code.must_equal '202'
|
86
86
|
|
87
87
|
# DELETE with URI value
|
88
|
-
cloud.orchestration.delete_stack(
|
89
|
-
cloud.orchestration.delete_stack(
|
88
|
+
cloud.orchestration.delete_stack('test_stack1', id1).code.must_equal '204'
|
89
|
+
cloud.orchestration.delete_stack('test_stack2', id2).code.must_equal '204'
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require 'misty'
|
2
2
|
require 'minitest/autorun'
|
3
3
|
require 'vcr'
|
4
4
|
require 'webmock/minitest'
|
5
5
|
|
6
6
|
VCR.configure do |config|
|
7
|
-
config.cassette_library_dir =
|
7
|
+
config.cassette_library_dir = 'test/integration/vcr'
|
8
8
|
config.hook_into :webmock
|
9
9
|
end
|
10
10
|
|
11
11
|
def auth
|
12
12
|
{
|
13
|
-
:url =>
|
14
|
-
:user =>
|
15
|
-
:password =>
|
16
|
-
:project =>
|
13
|
+
:url => 'http://192.0.2.21:5000',
|
14
|
+
:user => 'admin',
|
15
|
+
:password => 'CJk9hb2ZFR96Ypu74KFFGWuhv',
|
16
|
+
:project => 'admin',
|
17
17
|
:project_domain_id => 'default',
|
18
|
-
:domain =>
|
18
|
+
:domain => 'default'
|
19
19
|
}
|
20
20
|
end
|
data/test/unit/auth/name_test.rb
CHANGED
@@ -2,81 +2,81 @@ require 'test_helper'
|
|
2
2
|
require 'misty/auth/name'
|
3
3
|
|
4
4
|
describe Misty::Auth::Name do
|
5
|
-
describe
|
6
|
-
it
|
7
|
-
name = Misty::Auth::Name.new(
|
8
|
-
name.id.must_equal
|
9
|
-
name.name.must_equal
|
5
|
+
describe 'creates' do
|
6
|
+
it 'when id and name are provided' do
|
7
|
+
name = Misty::Auth::Name.new('default', 'Default')
|
8
|
+
name.id.must_equal 'default'
|
9
|
+
name.name.must_equal 'Default'
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
name = Misty::Auth::Name.new(nil,
|
12
|
+
it 'when id is null' do
|
13
|
+
name = Misty::Auth::Name.new(nil, 'Default')
|
14
14
|
name.id.must_be_nil
|
15
|
-
name.name.must_equal
|
15
|
+
name.name.must_equal 'Default'
|
16
16
|
end
|
17
17
|
|
18
18
|
name = Misty::Auth::Name.new(nil, nil)
|
19
|
-
it
|
20
|
-
name = Misty::Auth::Name.new(
|
21
|
-
name.id.must_equal
|
19
|
+
it 'when name is null' do
|
20
|
+
name = Misty::Auth::Name.new('default', nil)
|
21
|
+
name.id.must_equal 'default'
|
22
22
|
name.name.must_be_nil
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
25
|
+
it 'when both id and name is null' do
|
26
26
|
name = Misty::Auth::Name.new(nil, nil)
|
27
27
|
name.name.must_be_nil
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe
|
32
|
-
it
|
33
|
-
name = Misty::Auth::Name.new(
|
34
|
-
name.to_h(:id).must_equal ({:id =>
|
35
|
-
name.to_h(:name).must_equal ({:name =>
|
31
|
+
describe '#to_h' do
|
32
|
+
it 'returns the hash of provided attribute' do
|
33
|
+
name = Misty::Auth::Name.new('default', 'Default')
|
34
|
+
name.to_h(:id).must_equal ({:id => 'default'})
|
35
|
+
name.to_h(:name).must_equal ({:name => 'Default'})
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe Misty::Auth::User do
|
41
|
-
describe
|
42
|
-
it
|
43
|
-
user = Misty::Auth::User.new(
|
44
|
-
user.password =
|
45
|
-
user.identity.must_equal ({:user=>{:id=>
|
41
|
+
describe '#password' do
|
42
|
+
it 'set/get password' do
|
43
|
+
user = Misty::Auth::User.new('user_id', 'User')
|
44
|
+
user.password = 'secret'
|
45
|
+
user.identity.must_equal ({:user=>{:id=>'user_id', :password=>'secret'}})
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe
|
50
|
-
it
|
49
|
+
describe '#identity' do
|
50
|
+
it 'raises an error when password is missing' do
|
51
51
|
proc do
|
52
|
-
user = Misty::Auth::User.new(
|
52
|
+
user = Misty::Auth::User.new('user_id', 'User')
|
53
53
|
user.identity
|
54
54
|
end.must_raise Misty::Auth::CredentialsError
|
55
55
|
end
|
56
56
|
|
57
57
|
it "when id is provided it doesn't require domain" do
|
58
|
-
user = Misty::Auth::User.new(
|
59
|
-
user.password =
|
60
|
-
user.identity.must_equal ({:user=>{:id=>
|
58
|
+
user = Misty::Auth::User.new('user_id', 'User')
|
59
|
+
user.password = 'secret'
|
60
|
+
user.identity.must_equal ({:user=>{:id=>'user_id', :password=>'secret'}})
|
61
61
|
end
|
62
62
|
|
63
|
-
it
|
64
|
-
user = Misty::Auth::User.new(nil,
|
65
|
-
user.password =
|
66
|
-
user.domain = Misty::Auth::Name.new(
|
67
|
-
user.identity.must_equal ({:user=>{:name=>
|
63
|
+
it 'when id is nul and name is provided it uses domain id' do
|
64
|
+
user = Misty::Auth::User.new(nil, 'User')
|
65
|
+
user.password = 'secret'
|
66
|
+
user.domain = Misty::Auth::Name.new('default', nil)
|
67
|
+
user.identity.must_equal ({:user=>{:name=>'User', :domain=>{:id=>'default'}, :password=>'secret'}})
|
68
68
|
end
|
69
69
|
|
70
|
-
it
|
71
|
-
user = Misty::Auth::User.new(nil,
|
72
|
-
user.password =
|
73
|
-
user.domain = Misty::Auth::Name.new(nil,
|
74
|
-
user.identity.must_equal ({:user=>{:name=>
|
70
|
+
it 'when id is nul and name is provided it uses domain name' do
|
71
|
+
user = Misty::Auth::User.new(nil, 'User')
|
72
|
+
user.password = 'secret'
|
73
|
+
user.domain = Misty::Auth::Name.new(nil, 'Default')
|
74
|
+
user.identity.must_equal ({:user=>{:name=>'User', :domain=>{:name=>'Default'}, :password=>'secret'}})
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
77
|
+
it 'raises an error with no user id and no domain are provided' do
|
78
78
|
proc do
|
79
|
-
user = Misty::Auth::User.new(nil,
|
79
|
+
user = Misty::Auth::User.new(nil, 'User')
|
80
80
|
user.identity
|
81
81
|
end.must_raise Misty::Auth::CredentialsError
|
82
82
|
end
|
@@ -84,27 +84,27 @@ describe Misty::Auth::User do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
describe Misty::Auth::ProjectScope do
|
87
|
-
describe
|
87
|
+
describe '#identity' do
|
88
88
|
it "when id is provided it doesn't require domain" do
|
89
|
-
project = Misty::Auth::ProjectScope.new(
|
90
|
-
project.identity.must_equal ({:project=>{:id=>
|
89
|
+
project = Misty::Auth::ProjectScope.new('project_id', 'Project')
|
90
|
+
project.identity.must_equal ({:project=>{:id=>'project_id'}})
|
91
91
|
end
|
92
92
|
|
93
|
-
it
|
94
|
-
project = Misty::Auth::ProjectScope.new(nil,
|
95
|
-
project.domain = Misty::Auth::Name.new(
|
96
|
-
project.identity.must_equal ({:project=>{:name=>
|
93
|
+
it 'when id is nul and name is provided it uses domain id' do
|
94
|
+
project = Misty::Auth::ProjectScope.new(nil, 'Project')
|
95
|
+
project.domain = Misty::Auth::Name.new('default', nil)
|
96
|
+
project.identity.must_equal ({:project=>{:name=>'Project', :domain=>{:id=>'default'}}})
|
97
97
|
end
|
98
98
|
|
99
|
-
it
|
100
|
-
project = Misty::Auth::ProjectScope.new(nil,
|
101
|
-
project.domain = Misty::Auth::Name.new(nil,
|
102
|
-
project.identity.must_equal ({:project=>{:name=>
|
99
|
+
it 'when id is nul and name is provided it uses domain name' do
|
100
|
+
project = Misty::Auth::ProjectScope.new(nil, 'Project')
|
101
|
+
project.domain = Misty::Auth::Name.new(nil, 'Default')
|
102
|
+
project.identity.must_equal ({:project=>{:name=>'Project', :domain=>{:name=>'Default'}}})
|
103
103
|
end
|
104
104
|
|
105
|
-
it
|
105
|
+
it 'raises an error with no project id and no domain are provided' do
|
106
106
|
proc do
|
107
|
-
project = Misty::Auth::ProjectScope.new(nil,
|
107
|
+
project = Misty::Auth::ProjectScope.new(nil, 'Project')
|
108
108
|
project.identity
|
109
109
|
end.must_raise Misty::Auth::CredentialsError
|
110
110
|
end
|