Пример #1
0
    def test_credential_create(self, mock_create):
        trust_id = 'c8602dc1-677b-45bc-b732-3bc0d86d9537'
        cred = {'openstack': {'trust': trust_id}}
        req = vorc.CredentialCreateRequest(cred=cred, attrs={'k1': 'v1'})

        result = self.svc.credential_create(self.ctx, req.obj_to_primitive())

        self.assertEqual({'cred': cred}, result)
        mock_create.assert_called_once_with(
            self.ctx, {
                'user': '******',
                'project': 'fake_project_id',
                'cred': {
                    'openstack': {
                        'trust': trust_id
                    }
                }
            })
Пример #2
0
 def test_credential_create_request_full(self):
     body = copy.deepcopy(self.body)
     body['attrs'] = {'foo': 'bar'}
     sot = credentials.CredentialCreateRequest(**body)
     self.assertEqual(body['cred'], sot.cred)
     self.assertEqual(body['attrs'], sot.attrs)
Пример #3
0
 def test_credential_create_request(self):
     sot = credentials.CredentialCreateRequest(**self.body)
     self.assertEqual(self.body['cred'], sot.cred)
     sot.obj_set_defaults()
     self.assertEqual({}, sot.attrs)