test/yao/resources/test_role_assignment.rb in yao-0.7.0 vs test/yao/resources/test_role_assignment.rb in yao-0.8.0
- old
+ new
@@ -1,11 +1,7 @@
-class TestRoleAssignment < Test::Unit::TestCase
+class TestRoleAssignment < TestYaoResource
- def setup
- Yao.default_client.pool["compute"] = Yao::Client.gen_client("https://example.com:12345")
- end
-
def test_role_assignment
# https://docs.openstack.org/api-ref/identity/v3/?expanded=validate-and-show-information-for-token-detail,list-role-assignments-detail#list-role-assignments
params = {
"links" => {
@@ -35,11 +31,11 @@
assert_instance_of(Yao::Resources::User, role_assignment.user)
assert_equal(role_assignment.user.id, "313233")
end
def test_project
- stub_request(:get, "http://endpoint.example.com:12345/tenants/456789").
+ stub = stub_request(:get, "http://example.com:12345/tenants/456789").
to_return(
status: 200,
body: <<-JSON,
{
"tenant": {
@@ -59,7 +55,9 @@
}
role_assignment = Yao::RoleAssignment.new(params)
assert_instance_of(Yao::Resources::Tenant, role_assignment.project)
assert_equal(role_assignment.project.id, "456789")
+
+ assert_requested(stub)
end
end