Esempio n. 1
0
 def test_create_and_delete_ec2credential(self):
     fake_creds = mock.MagicMock()
     context = self._get_context()
     scenario = basic.CreateAndDeleteEc2Credential(context)
     scenario._create_ec2credentials = mock.MagicMock(
         return_value=fake_creds)
     scenario._delete_ec2credential = mock.MagicMock()
     scenario.run()
     scenario._create_ec2credentials.assert_called_once_with(
         "fake_user_id", "fake_tenant_id")
     scenario._delete_ec2credential.assert_called_once_with(
         "fake_user_id", fake_creds.access)
Esempio n. 2
0
    def test_create_and_delete_ec2credential(self):
        identity_service = self.mock_identity.return_value

        fake_creds = identity_service.create_ec2credentials.return_value

        scenario = basic.CreateAndDeleteEc2Credential(self.context)

        scenario.run()

        identity_service.create_ec2credentials.assert_called_once_with(
            self.context["user"]["id"],
            project_id=self.context["tenant"]["id"])
        identity_service.delete_ec2credential.assert_called_once_with(
            self.context["user"]["id"], access=fake_creds.access)