spec/misc_spec.rb in cf-uaa-lib-1.3.7 vs spec/misc_spec.rb in cf-uaa-lib-1.3.8
- old
+ new
@@ -35,8 +35,20 @@
result = Misc.server("https://uaa.cloudfoundry.com")
result["prompts"].should_not be_nil
result["commit_id"].should_not be_nil
end
+ it "gets UAA target" do
+ Misc.set_request_handler do |url, method, body, headers|
+ url.should == "https://login.cloudfoundry.com/login"
+ method.should == :get
+ headers["content-type"].should be_nil
+ headers["accept"].gsub(/\s/, '').should =~ /application\/json;charset=utf-8/i
+ [200, '{"links":{"uaa":"https://uaa.cloudfoundry.com"},"prompts":["one","two"]}', {"content-type" => "application/json"}]
+ end
+ result = Misc.discover_uaa("https://login.cloudfoundry.com")
+ result.should == "https://uaa.cloudfoundry.com"
+ end
+
end
end