misty 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -23
  3. data/lib/misty/auth.rb +24 -19
  4. data/lib/misty/auth/auth_v2.rb +12 -12
  5. data/lib/misty/auth/auth_v3.rb +15 -15
  6. data/lib/misty/autoload.rb +27 -27
  7. data/lib/misty/cloud.rb +2 -1
  8. data/lib/misty/http/client.rb +17 -15
  9. data/lib/misty/http/method_builder.rb +1 -1
  10. data/lib/misty/http/net_http.rb +12 -7
  11. data/lib/misty/http/request.rb +13 -7
  12. data/lib/misty/misty.rb +30 -30
  13. data/lib/misty/openstack/aodh/v2.rb +1 -1
  14. data/lib/misty/openstack/ceilometer/v2.rb +1 -1
  15. data/lib/misty/openstack/cinder/v1.rb +2 -2
  16. data/lib/misty/openstack/cinder/v2.rb +2 -2
  17. data/lib/misty/openstack/cinder/v3.rb +2 -2
  18. data/lib/misty/openstack/designate/v2.rb +1 -1
  19. data/lib/misty/openstack/freezer/v1.rb +1 -1
  20. data/lib/misty/openstack/glance/v1.rb +1 -1
  21. data/lib/misty/openstack/glance/v2.rb +1 -1
  22. data/lib/misty/openstack/heat/v1.rb +2 -2
  23. data/lib/misty/openstack/ironic/v1.rb +2 -2
  24. data/lib/misty/openstack/karbor/v1.rb +1 -1
  25. data/lib/misty/openstack/keystone/v2_0.rb +2 -2
  26. data/lib/misty/openstack/keystone/v3.rb +2 -2
  27. data/lib/misty/openstack/magnum/v1.rb +2 -2
  28. data/lib/misty/openstack/manila/v2.rb +2 -2
  29. data/lib/misty/openstack/microversion.rb +9 -9
  30. data/lib/misty/openstack/murano/v1.rb +1 -1
  31. data/lib/misty/openstack/neutron/v2_0.rb +1 -1
  32. data/lib/misty/openstack/nova/v2_1.rb +4 -4
  33. data/lib/misty/openstack/octavia/v2_0.rb +1 -1
  34. data/lib/misty/openstack/sahara/v1_1.rb +1 -1
  35. data/lib/misty/openstack/searchlight/v1.rb +1 -1
  36. data/lib/misty/openstack/senlin/v1.rb +1 -1
  37. data/lib/misty/openstack/swift/v1.rb +1 -1
  38. data/lib/misty/openstack/tacker/v1_0.rb +1 -1
  39. data/lib/misty/openstack/trove/v1_0.rb +1 -1
  40. data/lib/misty/openstack/zaqar/v2.rb +1 -1
  41. data/lib/misty/services.rb +1 -1
  42. data/lib/misty/version.rb +1 -1
  43. data/test/integration/compute_test.rb +17 -17
  44. data/test/integration/network_test.rb +16 -16
  45. data/test/integration/orchestration_test.rb +51 -51
  46. data/test/integration/test_helper.rb +7 -7
  47. data/test/unit/auth/name_test.rb +53 -53
  48. data/test/unit/auth_test.rb +151 -152
  49. data/test/unit/cloud/requests_test.rb +58 -58
  50. data/test/unit/cloud/services_test.rb +62 -62
  51. data/test/unit/cloud_test.rb +48 -48
  52. data/test/unit/http/client_test.rb +21 -28
  53. data/test/unit/http/direct_test.rb +31 -31
  54. data/test/unit/http/method_builder_test.rb +42 -42
  55. data/test/unit/http/request_test.rb +33 -33
  56. data/test/unit/misty_test.rb +28 -28
  57. data/test/unit/openstack/APIs_test.rb +3 -3
  58. data/test/unit/openstack/microversion_test.rb +14 -14
  59. data/test/unit/service_helper.rb +4 -4
  60. data/test/unit/services_test.rb +5 -5
  61. data/test/unit/test_helper.rb +1 -1
  62. metadata +4 -4
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/murano/murano_v1"
2
+ require 'misty/openstack/murano/murano_v1'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/neutron/neutron_v2_0"
2
+ require 'misty/openstack/neutron/neutron_v2_0'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,6 +1,6 @@
1
1
  require 'misty/http/client'
2
2
  require 'misty/openstack/microversion'
3
- require "misty/openstack/nova/nova_v2_1"
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("/", headers)
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
- "X-Openstack-Nova-API-Version" => "#{@version}",
32
+ 'X-Openstack-Nova-API-Version' => "#{@version}",
33
33
  # From version 2.27 the OpenStack-API-Version is used
34
- "X-Openstack-API-Version" => "#{baseclass.downcase} #{@version}"
34
+ 'X-Openstack-API-Version' => "#{baseclass.downcase} #{@version}"
35
35
  }
36
36
  end
37
37
  end
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/octavia/octavia_v2_0"
2
+ require 'misty/openstack/octavia/octavia_v2_0'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/sahara/sahara_v1_1"
2
+ require 'misty/openstack/sahara/sahara_v1_1'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/searchlight/searchlight_v1"
2
+ require 'misty/openstack/searchlight/searchlight_v1'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/senlin/senlin_v1"
2
+ require 'misty/openstack/senlin/senlin_v1'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/swift/swift_v1"
2
+ require 'misty/openstack/swift/swift_v1'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/tacker/tacker_v1_0"
2
+ require 'misty/openstack/tacker/tacker_v1_0'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/trove/trove_v1_0"
2
+ require 'misty/openstack/trove/trove_v1_0'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -1,5 +1,5 @@
1
1
  require 'misty/http/client'
2
- require "misty/openstack/zaqar/zaqar_v2"
2
+ require 'misty/openstack/zaqar/zaqar_v2'
3
3
 
4
4
  module Misty
5
5
  module Openstack
@@ -55,7 +55,7 @@ module Misty
55
55
  end
56
56
 
57
57
  def to_s
58
- list = ""
58
+ list = ''
59
59
  @services.each do |service|
60
60
  list << service.to_s + "\n"
61
61
  end
@@ -1,3 +1,3 @@
1
1
  module Misty
2
- VERSION = "0.7.2"
2
+ VERSION = '0.8.0'
3
3
  end
@@ -1,35 +1,35 @@
1
1
  require 'test_helper'
2
2
 
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"})
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 = { "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"]
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 "200"
18
- response.body["servers"].size.must_equal 2
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 "200"
23
- response.body["server"]["name"].must_equal "test_create_server"
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 = { "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"
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 "204"
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 "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"})
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("network" => { "name": "test_network" })
10
- response.code.must_equal "201"
11
- id = response.body["network"]["id"]
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 "200"
17
- response.body["networks"].size.must_equal 3
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 "200"
22
- response.body["network"]["name"].must_equal "test_network"
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 = { "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"
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 "204"
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
- "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" }
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
- "timeout_mins": 60
17
+ 'timeout_mins': 60
18
18
  }
19
19
 
20
20
  heat_template2 = {
21
- "files": {},
22
- "disable_rollback": true,
23
- "parameters": {
24
- "flavor": "m1.tiny"
21
+ 'files': {},
22
+ 'disable_rollback': true,
23
+ 'parameters': {
24
+ 'flavor': 'm1.tiny'
25
25
  },
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"
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
- "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\" &gt; /root/hello-world.txt\n"
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\' &gt; /root/hello-world.txt\n'
43
43
  }
44
44
  }
45
45
  }
46
46
  },
47
- "timeout_mins": 60
47
+ 'timeout_mins': 60
48
48
  }
49
49
 
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"})
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 "201"
58
- id1 = response.body["stack"]["id"]
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 "201"
63
- id2 = response.body["stack"]["id"]
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 "200"
69
- response.body["stacks"].size.must_equal 2
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("test_stack2", id2)
73
- response.code.must_equal "200"
74
- response.body["stack"]["stack_name"].must_equal "test_stack2"
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] = "Updated test template"
80
- response = cloud.orchestration.update_stack("test_stack1", id1, heat_template1)
81
- response.code.must_equal "202"
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("test_stack1", id1, "disable_rollback": false)
85
- response.code.must_equal "202"
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("test_stack1", id1).code.must_equal "204"
89
- cloud.orchestration.delete_stack("test_stack2", id2).code.must_equal "204"
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 "misty"
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 = "test/integration/vcr"
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 => "http://192.0.2.21:5000",
14
- :user => "admin",
15
- :password => "CJk9hb2ZFR96Ypu74KFFGWuhv",
16
- :project => "admin",
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 => "default"
18
+ :domain => 'default'
19
19
  }
20
20
  end
@@ -2,81 +2,81 @@ require 'test_helper'
2
2
  require 'misty/auth/name'
3
3
 
4
4
  describe Misty::Auth::Name do
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"
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 "when id is null" do
13
- name = Misty::Auth::Name.new(nil, "Default")
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 "Default"
15
+ name.name.must_equal 'Default'
16
16
  end
17
17
 
18
18
  name = Misty::Auth::Name.new(nil, nil)
19
- it "when name is null" do
20
- name = Misty::Auth::Name.new("default", nil)
21
- name.id.must_equal "default"
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 "when both id and name is null" do
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 "#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"})
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 "#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"}})
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 "#identity" do
50
- it "raises an error when password is missing" do
49
+ describe '#identity' do
50
+ it 'raises an error when password is missing' do
51
51
  proc do
52
- user = Misty::Auth::User.new("user_id", "User")
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("user_id", "User")
59
- user.password = "secret"
60
- user.identity.must_equal ({:user=>{:id=>"user_id", :password=>"secret"}})
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 "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"}})
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 "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"}})
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 "raises an error with no user id and no domain are provided" do
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, "User")
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 "#identity" do
87
+ describe '#identity' do
88
88
  it "when id is provided it doesn't require domain" do
89
- project = Misty::Auth::ProjectScope.new("project_id", "Project")
90
- project.identity.must_equal ({:project=>{:id=>"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 "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"}}})
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 "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"}}})
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 "raises an error with no project id and no domain are provided" do
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, "Project")
107
+ project = Misty::Auth::ProjectScope.new(nil, 'Project')
108
108
  project.identity
109
109
  end.must_raise Misty::Auth::CredentialsError
110
110
  end