nephophobia 0.3.0 → 0.3.6
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.
- data/lib/nephophobia.rb +26 -37
- data/lib/nephophobia/client.rb +6 -6
- data/lib/nephophobia/resource/compute.rb +209 -0
- data/lib/nephophobia/resource/credential.rb +68 -0
- data/lib/nephophobia/resource/image.rb +65 -0
- data/lib/nephophobia/resource/project.rb +132 -0
- data/lib/nephophobia/resource/role.rb +72 -0
- data/lib/nephophobia/resource/user.rb +83 -0
- data/lib/nephophobia/response/address.rb +13 -0
- data/lib/nephophobia/response/compute.rb +34 -0
- data/lib/nephophobia/response/credential.rb +17 -0
- data/lib/nephophobia/response/image.rb +24 -0
- data/lib/nephophobia/response/member.rb +15 -0
- data/lib/nephophobia/response/project.rb +18 -0
- data/lib/nephophobia/response/return.rb +16 -0
- data/lib/nephophobia/response/role.rb +15 -0
- data/lib/nephophobia/response/user.rb +17 -0
- data/lib/nephophobia/response/vnc.rb +11 -0
- data/lib/nephophobia/util.rb +12 -0
- data/lib/nephophobia/version.rb +1 -1
- data/nephophobia.gemspec +2 -2
- data/test/cassettes/compute_describe_addresses.yml +244 -0
- data/test/cassettes/compute_find.yml +30 -18
- data/test/cassettes/credential_import.yml +82 -0
- data/test/cassettes/role_all_no_params.yml +82 -0
- data/test/cassettes/role_modify_role.yml +190 -0
- data/test/dummy.pub +1 -0
- data/test/lib/nephophobia/{compute_test.rb → response/compute_test.rb} +39 -4
- data/test/lib/nephophobia/{credential_test.rb → response/credential_test.rb} +28 -1
- data/test/lib/nephophobia/{image_test.rb → response/image_test.rb} +1 -1
- data/test/lib/nephophobia/{project_test.rb → response/project_test.rb} +1 -1
- data/test/lib/nephophobia/{role_test.rb → response/role_test.rb} +57 -4
- data/test/lib/nephophobia/{user_test.rb → response/user_test.rb} +1 -1
- data/test/lib/{nephophobia_test.rb → nephophobia/util_test.rb} +3 -3
- data/test/test_helper.rb +7 -0
- metadata +45 -24
- data/lib/nephophobia/compute.rb +0 -243
- data/lib/nephophobia/credential.rb +0 -65
- data/lib/nephophobia/image.rb +0 -84
- data/lib/nephophobia/project.rb +0 -157
- data/lib/nephophobia/role.rb +0 -83
- data/lib/nephophobia/user.rb +0 -95
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=RegisterUser&Name=vcr_user&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&Version=2010-11-15&Signature=6AjzqntOVWOXKISXoh%2BEAq9jrsgrH%2BKnfpTSBzx%2B%2F6A%3D
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- application/xml
|
10
|
+
connection:
|
11
|
+
- keep-alive
|
12
|
+
keep-alive:
|
13
|
+
- 30
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
content-type:
|
20
|
+
- text/xml
|
21
|
+
content-length:
|
22
|
+
- "313"
|
23
|
+
date:
|
24
|
+
- Mon, 06 Jun 2011 19:19:12 GMT
|
25
|
+
connection:
|
26
|
+
- keep-alive
|
27
|
+
body: <?xml version="1.0" ?><RegisterUserResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>NL8SMRG302C7PM8VCU6V</requestId><username>vcr_user</username><secretkey>e6175f42-e224-4ba2-810f-6999d81729b2</secretkey><accesskey>b2ae0ffc-22e0-40b3-af26-e4e3901bcc6b</accesskey><file/></RegisterUserResponse>
|
28
|
+
http_version: "1.1"
|
29
|
+
- !ruby/struct:VCR::HTTPInteraction
|
30
|
+
request: !ruby/struct:VCR::Request
|
31
|
+
method: :get
|
32
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=DescribeRoles&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&Version=2010-11-15&Signature=Jv4LbhnoGLXQ4hLiU2nLgYZgfM0WweZudC%2FOHtal2Mc%3D
|
33
|
+
body:
|
34
|
+
headers:
|
35
|
+
accept:
|
36
|
+
- application/xml
|
37
|
+
connection:
|
38
|
+
- keep-alive
|
39
|
+
keep-alive:
|
40
|
+
- 30
|
41
|
+
response: !ruby/struct:VCR::Response
|
42
|
+
status: !ruby/struct:VCR::ResponseStatus
|
43
|
+
code: 200
|
44
|
+
message: OK
|
45
|
+
headers:
|
46
|
+
content-type:
|
47
|
+
- text/xml
|
48
|
+
content-length:
|
49
|
+
- "279"
|
50
|
+
date:
|
51
|
+
- Mon, 06 Jun 2011 19:19:12 GMT
|
52
|
+
connection:
|
53
|
+
- keep-alive
|
54
|
+
body: <?xml version="1.0" ?><DescribeRolesResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>TUTAQ1-YFNCOBOIDDSTT</requestId><roles><item><role>sysadmin</role></item><item><role>netadmin</role></item><item><role>developer</role></item></roles></DescribeRolesResponse>
|
55
|
+
http_version: "1.1"
|
56
|
+
- !ruby/struct:VCR::HTTPInteraction
|
57
|
+
request: !ruby/struct:VCR::Request
|
58
|
+
method: :get
|
59
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=DeregisterUser&Name=vcr_user&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&Version=2010-11-15&Signature=xE0f9t0Pixm0FkSRS%2B9oaao1FoM7o682i0gYkIlfwSU%3D
|
60
|
+
body:
|
61
|
+
headers:
|
62
|
+
accept:
|
63
|
+
- application/xml
|
64
|
+
connection:
|
65
|
+
- keep-alive
|
66
|
+
keep-alive:
|
67
|
+
- 30
|
68
|
+
response: !ruby/struct:VCR::Response
|
69
|
+
status: !ruby/struct:VCR::ResponseStatus
|
70
|
+
code: 200
|
71
|
+
message: OK
|
72
|
+
headers:
|
73
|
+
content-type:
|
74
|
+
- text/xml
|
75
|
+
content-length:
|
76
|
+
- "184"
|
77
|
+
date:
|
78
|
+
- Mon, 06 Jun 2011 19:19:13 GMT
|
79
|
+
connection:
|
80
|
+
- keep-alive
|
81
|
+
body: <?xml version="1.0" ?><DeregisterUserResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>2UDZR8J5S3XPRMCF87C9</requestId><return>true</return></DeregisterUserResponse>
|
82
|
+
http_version: "1.1"
|
@@ -0,0 +1,190 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=RegisterUser&Name=vcr_user&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&Version=2010-11-15&Signature=6AjzqntOVWOXKISXoh%2BEAq9jrsgrH%2BKnfpTSBzx%2B%2F6A%3D
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- application/xml
|
10
|
+
connection:
|
11
|
+
- keep-alive
|
12
|
+
keep-alive:
|
13
|
+
- 30
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
content-type:
|
20
|
+
- text/xml
|
21
|
+
content-length:
|
22
|
+
- "313"
|
23
|
+
date:
|
24
|
+
- Sat, 04 Jun 2011 06:48:01 GMT
|
25
|
+
connection:
|
26
|
+
- keep-alive
|
27
|
+
body: <?xml version="1.0" ?><RegisterUserResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>LU7U8X5WMRRZ17DYJ4WZ</requestId><username>vcr_user</username><secretkey>ca9aeab9-5d82-47aa-a243-d9d05faa8ee8</secretkey><accesskey>ff27f702-708a-40fa-978c-fbf86c0148ef</accesskey><file/></RegisterUserResponse>
|
28
|
+
http_version: "1.1"
|
29
|
+
- !ruby/struct:VCR::HTTPInteraction
|
30
|
+
request: !ruby/struct:VCR::Request
|
31
|
+
method: :get
|
32
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=ModifyUserRole&Operation=add&Project=sandbox&Role=sysadmin&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&User=vcr_user&Version=2010-11-15&Signature=ACwX6Rx4GWaes1GnO5%2Bf0GZRu%2F4CWgvfuiVv%2BP7Ocno%3D
|
33
|
+
body:
|
34
|
+
headers:
|
35
|
+
accept:
|
36
|
+
- application/xml
|
37
|
+
connection:
|
38
|
+
- keep-alive
|
39
|
+
keep-alive:
|
40
|
+
- 30
|
41
|
+
response: !ruby/struct:VCR::Response
|
42
|
+
status: !ruby/struct:VCR::ResponseStatus
|
43
|
+
code: 200
|
44
|
+
message: OK
|
45
|
+
headers:
|
46
|
+
content-type:
|
47
|
+
- text/xml
|
48
|
+
content-length:
|
49
|
+
- "184"
|
50
|
+
date:
|
51
|
+
- Sat, 04 Jun 2011 06:48:01 GMT
|
52
|
+
connection:
|
53
|
+
- keep-alive
|
54
|
+
body: <?xml version="1.0" ?><ModifyUserRoleResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>PTE4R7PCCE9QE4Z1H82U</requestId><return>true</return></ModifyUserRoleResponse>
|
55
|
+
http_version: "1.1"
|
56
|
+
- !ruby/struct:VCR::HTTPInteraction
|
57
|
+
request: !ruby/struct:VCR::Request
|
58
|
+
method: :get
|
59
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=ModifyUserRole&Operation=add&Project=sandbox&Role=netadmin&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&User=vcr_user&Version=2010-11-15&Signature=qQUGFCxdkYobbzS7KcOoI0f%2BnR5ZpfYt8BY9Id6FsnA%3D
|
60
|
+
body:
|
61
|
+
headers:
|
62
|
+
accept:
|
63
|
+
- application/xml
|
64
|
+
connection:
|
65
|
+
- keep-alive
|
66
|
+
keep-alive:
|
67
|
+
- 30
|
68
|
+
response: !ruby/struct:VCR::Response
|
69
|
+
status: !ruby/struct:VCR::ResponseStatus
|
70
|
+
code: 200
|
71
|
+
message: OK
|
72
|
+
headers:
|
73
|
+
content-type:
|
74
|
+
- text/xml
|
75
|
+
content-length:
|
76
|
+
- "184"
|
77
|
+
date:
|
78
|
+
- Sat, 04 Jun 2011 06:48:02 GMT
|
79
|
+
connection:
|
80
|
+
- keep-alive
|
81
|
+
body: <?xml version="1.0" ?><ModifyUserRoleResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>5188P6J4UKHBU32LKAR9</requestId><return>true</return></ModifyUserRoleResponse>
|
82
|
+
http_version: "1.1"
|
83
|
+
- !ruby/struct:VCR::HTTPInteraction
|
84
|
+
request: !ruby/struct:VCR::Request
|
85
|
+
method: :get
|
86
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=DescribeUserRoles&Project=sandbox&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&User=vcr_user&Version=2010-11-15&Signature=3qXbAY%2FRzK%2Bj6czyRJIFBKXUagipYCuc87c6SU1YBhY%3D
|
87
|
+
body:
|
88
|
+
headers:
|
89
|
+
accept:
|
90
|
+
- application/xml
|
91
|
+
connection:
|
92
|
+
- keep-alive
|
93
|
+
keep-alive:
|
94
|
+
- 30
|
95
|
+
response: !ruby/struct:VCR::Response
|
96
|
+
status: !ruby/struct:VCR::ResponseStatus
|
97
|
+
code: 200
|
98
|
+
message: OK
|
99
|
+
headers:
|
100
|
+
content-type:
|
101
|
+
- text/xml
|
102
|
+
content-length:
|
103
|
+
- "252"
|
104
|
+
date:
|
105
|
+
- Sat, 04 Jun 2011 06:48:03 GMT
|
106
|
+
connection:
|
107
|
+
- keep-alive
|
108
|
+
body: <?xml version="1.0" ?><DescribeUserRolesResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>4YT2VYK6X8E30AERHI9M</requestId><roles><item><role>netadmin</role></item><item><role>sysadmin</role></item></roles></DescribeUserRolesResponse>
|
109
|
+
http_version: "1.1"
|
110
|
+
- !ruby/struct:VCR::HTTPInteraction
|
111
|
+
request: !ruby/struct:VCR::Request
|
112
|
+
method: :get
|
113
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=ModifyUserRole&Operation=remove&Project=sandbox&Role=sysadmin&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&User=vcr_user&Version=2010-11-15&Signature=DWp%2BZDUufJy2QBF0V49J3sM9Spn%2BO6V8yB288JVe1e4%3D
|
114
|
+
body:
|
115
|
+
headers:
|
116
|
+
accept:
|
117
|
+
- application/xml
|
118
|
+
connection:
|
119
|
+
- keep-alive
|
120
|
+
keep-alive:
|
121
|
+
- 30
|
122
|
+
response: !ruby/struct:VCR::Response
|
123
|
+
status: !ruby/struct:VCR::ResponseStatus
|
124
|
+
code: 200
|
125
|
+
message: OK
|
126
|
+
headers:
|
127
|
+
content-type:
|
128
|
+
- text/xml
|
129
|
+
content-length:
|
130
|
+
- "184"
|
131
|
+
date:
|
132
|
+
- Sat, 04 Jun 2011 06:48:03 GMT
|
133
|
+
connection:
|
134
|
+
- keep-alive
|
135
|
+
body: <?xml version="1.0" ?><ModifyUserRoleResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>QYAL523-DWL2KWKNFHPH</requestId><return>true</return></ModifyUserRoleResponse>
|
136
|
+
http_version: "1.1"
|
137
|
+
- !ruby/struct:VCR::HTTPInteraction
|
138
|
+
request: !ruby/struct:VCR::Request
|
139
|
+
method: :get
|
140
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=DescribeUserRoles&Project=sandbox&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&User=vcr_user&Version=2010-11-15&Signature=3qXbAY%2FRzK%2Bj6czyRJIFBKXUagipYCuc87c6SU1YBhY%3D
|
141
|
+
body:
|
142
|
+
headers:
|
143
|
+
accept:
|
144
|
+
- application/xml
|
145
|
+
connection:
|
146
|
+
- keep-alive
|
147
|
+
keep-alive:
|
148
|
+
- 30
|
149
|
+
response: !ruby/struct:VCR::Response
|
150
|
+
status: !ruby/struct:VCR::ResponseStatus
|
151
|
+
code: 200
|
152
|
+
message: OK
|
153
|
+
headers:
|
154
|
+
content-type:
|
155
|
+
- text/xml
|
156
|
+
content-length:
|
157
|
+
- "218"
|
158
|
+
date:
|
159
|
+
- Sat, 04 Jun 2011 06:48:04 GMT
|
160
|
+
connection:
|
161
|
+
- keep-alive
|
162
|
+
body: <?xml version="1.0" ?><DescribeUserRolesResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>9-9COQKIG1FVDF1002BV</requestId><roles><item><role>netadmin</role></item></roles></DescribeUserRolesResponse>
|
163
|
+
http_version: "1.1"
|
164
|
+
- !ruby/struct:VCR::HTTPInteraction
|
165
|
+
request: !ruby/struct:VCR::Request
|
166
|
+
method: :get
|
167
|
+
uri: http://10.3.170.32:8773/services/Admin?AWSAccessKeyId=03982c2e-8e28-40b6-95e2-f2811383b4a2%3Asandbox&Action=DeregisterUser&Name=vcr_user&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=1999-12-31T19%3A59%3A59Z&Version=2010-11-15&Signature=xE0f9t0Pixm0FkSRS%2B9oaao1FoM7o682i0gYkIlfwSU%3D
|
168
|
+
body:
|
169
|
+
headers:
|
170
|
+
accept:
|
171
|
+
- application/xml
|
172
|
+
connection:
|
173
|
+
- keep-alive
|
174
|
+
keep-alive:
|
175
|
+
- 30
|
176
|
+
response: !ruby/struct:VCR::Response
|
177
|
+
status: !ruby/struct:VCR::ResponseStatus
|
178
|
+
code: 200
|
179
|
+
message: OK
|
180
|
+
headers:
|
181
|
+
content-type:
|
182
|
+
- text/xml
|
183
|
+
content-length:
|
184
|
+
- "184"
|
185
|
+
date:
|
186
|
+
- Sat, 04 Jun 2011 06:48:05 GMT
|
187
|
+
connection:
|
188
|
+
- keep-alive
|
189
|
+
body: <?xml version="1.0" ?><DeregisterUserResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/"><requestId>TQJ6PA8EHV9ULLBLBR3A</requestId><return>true</return></DeregisterUserResponse>
|
190
|
+
http_version: "1.1"
|
data/test/dummy.pub
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ssh-dss AAAAB3NzaC1kc3MAAACBAMGJlY9XEIm2X234pdO5yFWMp2JuOQx8U0E815IVXhmKxYCBK9ZakgZOIQmPbXoGYyV+mziDPp6HJ0wKYLQxkwLEFr51fAZjWQvRss0SinURRuLkockDfGFtD4pYJthekr/rlqMKlBSDUSpGq8jUWW60UJ18FGooFpxR7ESqQRx/AAAAFQC96LRglaUeeP+E8U/yblEJocuiWwAAAIA3XiMR8Skiz/0aBm5K50SeQznQuMJTyzt9S9uaz5QZWiFu69hOyGSFGw8fqgxEkXFJIuHobQQpGYQubLW0NdaYRqyE/Vud3JUJUb8Texld6dz8vGemyB5d1YvtSeHIo8/BGv2msOqR3u5AZTaGCBD9DhpSGOKHEdNjTtvpPd8S8gAAAIBociGZ5jf09iHLVENhyXujJbxfGRPsyNTyARJfCOGl0oFV6hEzcQyw8U/ePwjgvjc2UizMWLl8tsb2FXKHRdc2v+ND3Us+XqKQ33X3ADP4FZ/+Oj213gMyhCmvFTP0u5FmHog9My4CB7YcIWRuUR42WlhQ2IfPvKwUoTk3R+T6Og== www-data@mk
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
-
describe Nephophobia::Compute do
|
3
|
+
describe Nephophobia::Resource::Compute do
|
4
4
|
##
|
5
5
|
# Note:
|
6
6
|
# Assumes there is always at least one valid project.
|
@@ -105,6 +105,7 @@ describe Nephophobia::Compute do
|
|
105
105
|
describe "#find" do
|
106
106
|
before do
|
107
107
|
VCR.use_cassette "compute_find" do
|
108
|
+
@compute = ::Client.trunk_with(:admin).compute
|
108
109
|
@instance_id = @compute.create(@image_id).instance_id
|
109
110
|
|
110
111
|
@response = @compute.find @instance_id
|
@@ -135,6 +136,8 @@ describe Nephophobia::Compute do
|
|
135
136
|
@response.launch_time.must_be_kind_of DateTime
|
136
137
|
@response.placement.must_match %r{[a-z]+}
|
137
138
|
@response.instance_type.must_match %r{[a-z]{2}.[a-z]+}
|
139
|
+
@response.ip_address.must_match %r{[0-9]{1,3}+\.[0-9]{1,3}}
|
140
|
+
@response.private_ip_address.must_match %r{[0-9]{1,3}+\.[0-9]{1,3}}
|
138
141
|
end
|
139
142
|
end
|
140
143
|
|
@@ -236,7 +239,7 @@ describe Nephophobia::Compute do
|
|
236
239
|
@floating_ip = @compute.allocate_address.floating_ip
|
237
240
|
@instance_id = @compute.create(@image_id).instance_id
|
238
241
|
|
239
|
-
|
242
|
+
wait
|
240
243
|
|
241
244
|
@response = @compute.associate_address @instance_id, @floating_ip
|
242
245
|
end
|
@@ -262,10 +265,10 @@ describe Nephophobia::Compute do
|
|
262
265
|
@floating_ip = @compute.allocate_address.floating_ip
|
263
266
|
@instance_id = @compute.create(@image_id).instance_id
|
264
267
|
|
265
|
-
|
268
|
+
wait
|
266
269
|
@compute.associate_address @instance_id, @floating_ip
|
267
270
|
|
268
|
-
|
271
|
+
wait
|
269
272
|
@response = @compute.disassociate_address @floating_ip
|
270
273
|
end
|
271
274
|
end
|
@@ -281,4 +284,36 @@ describe Nephophobia::Compute do
|
|
281
284
|
@response.status.must_equal "Address disassociated."
|
282
285
|
end
|
283
286
|
end
|
287
|
+
|
288
|
+
describe "#describe_addresses" do
|
289
|
+
before do
|
290
|
+
VCR.use_cassette "compute_describe_addresses" do
|
291
|
+
@compute = ::Client.trunk_with(:admin).compute
|
292
|
+
@floating_ip1 = @compute.allocate_address.floating_ip
|
293
|
+
@floating_ip2 = @compute.allocate_address.floating_ip
|
294
|
+
@instance_id = @compute.create(@image_id).instance_id
|
295
|
+
|
296
|
+
wait unless VCR.current_cassette.record_mode == :none
|
297
|
+
@compute.associate_address @instance_id, @floating_ip1
|
298
|
+
@response = @compute.describe_addresses
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
after do
|
303
|
+
VCR.use_cassette "compute_describe_addresses" do
|
304
|
+
@response = @compute.disassociate_address @floating_ip1
|
305
|
+
@compute.destroy @instance_id
|
306
|
+
@compute.release_address @floating_ip1
|
307
|
+
@compute.release_address @floating_ip2
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
it "lists floating ips" do
|
312
|
+
resp1 = @response.find{|a| a.floating_ip == @floating_ip1}
|
313
|
+
resp1.instance_id.must_match %r{#{@instance_id} \(#{@project_name}\)}
|
314
|
+
resp2 = @response.find{|a| a.floating_ip == @floating_ip2}
|
315
|
+
resp2.instance_id.must_match %r{None \(#{@project_name}\)}
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
284
319
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
describe Nephophobia::Credential do
|
3
|
+
describe Nephophobia::Resource::Credential do
|
4
4
|
##
|
5
5
|
# Note:
|
6
6
|
# Assumes there is always at least one valid project.
|
@@ -75,4 +75,31 @@ describe Nephophobia::Credential do
|
|
75
75
|
@response.return.must_equal true
|
76
76
|
end
|
77
77
|
end
|
78
|
+
|
79
|
+
describe "#import_public_key" do
|
80
|
+
before do
|
81
|
+
VCR.use_cassette "credential_import" do
|
82
|
+
@credential = ::Client.trunk_with(:admin).credential
|
83
|
+
file = File.open("test/dummy.pub", "rb")
|
84
|
+
@key_name = 'dummy'
|
85
|
+
@pubkey = file.read.chomp
|
86
|
+
@response = @credential.import_public_key @key_name, @pubkey
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
after do
|
91
|
+
VCR.use_cassette "credential_import" do
|
92
|
+
@credential.destroy @key_name
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
it "imports the key pair" do
|
97
|
+
@response.attributes.must_equal 'true'
|
98
|
+
VCR.use_cassette "credential_import" do
|
99
|
+
allresp = @credential.all
|
100
|
+
key_pair = allresp.find{|kp| kp.name == 'dummy'}
|
101
|
+
key_pair.fingerprint.must_equal "1c:87:d1:d9:32:fd:62:3c:78:2b:c0:ad:c0:15:88:df"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
78
105
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
-
describe Nephophobia::Role do
|
3
|
+
describe Nephophobia::Resource::Role do
|
4
4
|
##
|
5
5
|
# Note:
|
6
6
|
# Assumes there is always at least one valid project.
|
@@ -15,6 +15,30 @@ describe Nephophobia::Role do
|
|
15
15
|
@user = ::Client.with(:admin).user
|
16
16
|
end
|
17
17
|
|
18
|
+
describe "#all without params" do
|
19
|
+
before do
|
20
|
+
VCR.use_cassette "role_all_no_params" do
|
21
|
+
@user.create @user_name
|
22
|
+
@response = @role.all
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
VCR.use_cassette "role_all_no_params" do
|
28
|
+
@user.destroy @user_name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns all roles" do
|
33
|
+
VCR.use_cassette "role_all_no_params" do
|
34
|
+
all_roles = @response.collect(&:name)
|
35
|
+
all_roles.must_include 'sysadmin'
|
36
|
+
all_roles.must_include 'netadmin'
|
37
|
+
all_roles.must_include 'developer'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
18
42
|
describe "#all with a 'user_name'" do
|
19
43
|
before do
|
20
44
|
VCR.use_cassette "role_all" do
|
@@ -32,14 +56,14 @@ describe Nephophobia::Role do
|
|
32
56
|
end
|
33
57
|
end
|
34
58
|
|
35
|
-
it "returns all roles" do
|
59
|
+
it "returns all roles for user" do
|
36
60
|
VCR.use_cassette "role_all" do
|
37
61
|
@response.size.must_be :>=, 1
|
38
62
|
end
|
39
63
|
end
|
40
64
|
end
|
41
65
|
|
42
|
-
describe "#all without roles" do
|
66
|
+
describe "#all with a 'user_name' but without roles" do
|
43
67
|
before do
|
44
68
|
VCR.use_cassette "role_all_without_roles" do
|
45
69
|
@user.create @user_name
|
@@ -55,7 +79,7 @@ describe Nephophobia::Role do
|
|
55
79
|
end
|
56
80
|
end
|
57
81
|
|
58
|
-
it "returns
|
82
|
+
it "returns no roles for user" do
|
59
83
|
@response.must_be_nil
|
60
84
|
end
|
61
85
|
end
|
@@ -103,6 +127,35 @@ describe Nephophobia::Role do
|
|
103
127
|
end
|
104
128
|
end
|
105
129
|
|
130
|
+
describe "#modify_role" do
|
131
|
+
before do
|
132
|
+
VCR.use_cassette "role_modify_role" do
|
133
|
+
@user.create @user_name
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
after do
|
138
|
+
VCR.use_cassette "role_modify_role" do
|
139
|
+
@user.destroy @user_name
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
it "allows adding and deleting of roles" do
|
144
|
+
VCR.use_cassette "role_modify_role" do
|
145
|
+
@role.modify_role @user_name, 'add', @project_name, 'sysadmin'
|
146
|
+
@role.modify_role @user_name, 'add', @project_name, 'netadmin'
|
147
|
+
roles = @role.all(@user_name, @project_name).collect(&:name)
|
148
|
+
roles.size.must_equal 2
|
149
|
+
roles.must_include 'sysadmin'
|
150
|
+
roles.must_include 'netadmin'
|
151
|
+
@role.modify_role @user_name, 'remove', @project_name, 'sysadmin'
|
152
|
+
roles = @role.all(@user_name, @project_name).collect(&:name)
|
153
|
+
roles.size.must_equal 1
|
154
|
+
roles.must_include 'netadmin'
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
106
159
|
describe "#create with 'user_name' and 'project_name'" do
|
107
160
|
before do
|
108
161
|
VCR.use_cassette "role_create_with_project_name" do
|