cfoundry 0.5.3.rc1 → 0.5.3.rc2
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/cc_api_stub/login.rb
CHANGED
data/lib/cfoundry/baseclient.rb
CHANGED
@@ -24,7 +24,11 @@ module CFoundry
|
|
24
24
|
|
25
25
|
def uaa
|
26
26
|
@uaa ||= begin
|
27
|
-
|
27
|
+
endpoint =
|
28
|
+
info[:token_endpoint] || \
|
29
|
+
info[:authorization_endpoint]
|
30
|
+
|
31
|
+
if endpoint
|
28
32
|
uaa = CFoundry::UAAClient.new(endpoint)
|
29
33
|
uaa.trace = trace
|
30
34
|
uaa.token = token
|
data/lib/cfoundry/uaaclient.rb
CHANGED
data/lib/cfoundry/version.rb
CHANGED
@@ -8,7 +8,7 @@ describe CcApiStub::Login do
|
|
8
8
|
let(:url) { host + "/info" }
|
9
9
|
subject { CcApiStub::Login.succeeds_to_find_uaa(host) }
|
10
10
|
|
11
|
-
it_behaves_like "a stubbed get request", :including_json => {'
|
11
|
+
it_behaves_like "a stubbed get request", :including_json => {'token_endpoint' => 'https://uaa.localhost'}
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '.succeeds_to_login_as_admin' do
|
@@ -17,4 +17,4 @@ describe CcApiStub::Login do
|
|
17
17
|
|
18
18
|
it_behaves_like "a stubbed post request", :code => 302, :ignore_response => true
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|
@@ -103,8 +103,10 @@ describe CFoundry::BaseClient do
|
|
103
103
|
|
104
104
|
describe "UAAClient" do
|
105
105
|
context "with a valid uaa endpoint" do
|
106
|
+
let(:info) { { :token_endpoint => "http://uaa.example.com" } }
|
107
|
+
|
106
108
|
before do
|
107
|
-
stub(subject).info {
|
109
|
+
stub(subject).info { info }
|
108
110
|
end
|
109
111
|
|
110
112
|
describe "#uaa" do
|
@@ -122,6 +124,15 @@ describe CFoundry::BaseClient do
|
|
122
124
|
stub(subject).token { token }
|
123
125
|
expect(subject.uaa.token).to eq token
|
124
126
|
end
|
127
|
+
|
128
|
+
context "with the endpoint as 'authorization_endpoint'" do
|
129
|
+
let(:info) { { :authorization_endpoint => "foo" } }
|
130
|
+
|
131
|
+
it "uses it to create the UAAClient" do
|
132
|
+
expect(subject.uaa).to be_a CFoundry::UAAClient
|
133
|
+
expect(subject.uaa.target).to eq "foo"
|
134
|
+
end
|
135
|
+
end
|
125
136
|
end
|
126
137
|
|
127
138
|
describe "#token=" do
|
@@ -161,7 +172,7 @@ describe CFoundry::BaseClient do
|
|
161
172
|
describe "#password_score" do
|
162
173
|
context "with a uaa" do
|
163
174
|
before do
|
164
|
-
stub(subject).info { { :
|
175
|
+
stub(subject).info { { :token_endpoint => "http://uaa.example.com" } }
|
165
176
|
end
|
166
177
|
|
167
178
|
it "delegates to the uaa's password strength method" do
|
@@ -243,6 +243,30 @@ EOF
|
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
246
|
+
describe "#delete_user" do
|
247
|
+
let(:guid) { "123" }
|
248
|
+
let!(:req) {
|
249
|
+
stub_request(
|
250
|
+
:delete,
|
251
|
+
"https://uaa.example.com/Users/123"
|
252
|
+
).to_return(:status => 200, :body => '{ "foo": "bar" }')
|
253
|
+
}
|
254
|
+
|
255
|
+
subject { uaa }
|
256
|
+
|
257
|
+
it "wraps uaa errors" do
|
258
|
+
mock(uaa).wrap_uaa_errors
|
259
|
+
subject.delete_user(guid)
|
260
|
+
end
|
261
|
+
|
262
|
+
context 'with valid data' do
|
263
|
+
it "should add a user" do
|
264
|
+
subject.delete_user(guid)
|
265
|
+
expect(req).to have_been_requested
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
246
270
|
describe "#wrap_uaa_errors" do
|
247
271
|
subject { uaa.send(:wrap_uaa_errors) { raise error } }
|
248
272
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfoundry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -1906723574
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
9
|
- 3
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 0.5.3.
|
11
|
+
- 2
|
12
|
+
version: 0.5.3.rc2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Cloud Foundry Team
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2013-03-
|
21
|
+
date: 2013-03-07 00:00:00 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|