def test_checkout_group_exception(self):
mocker = AWSMock()
self.c.login(username=self.user.username, password='str0ngpa$$w0rd')
# Test create IAM account group not found exception handled
with patch('botocore.client.BaseClient._make_api_call',
new=mocker.mock_make_api_call):
with self.settings(AWS_IAM_GROUP='Admins',
AWS_ACCOUNT_ID_ALIAS=None):
response = self.c.get(reverse('library:checkout',
args=['amazondemoaccount']),
follow=True)
# Confirm error message displayed
message = list(response.context['messages'])[0].message
self.assertEqual(message,
"An error occurred (Not Found) when calling the "
"AddUserToGroup operation: Group Admins not found")
# Confirm lendable not created
self.assertEqual(Lendable.all_types.count(), 0)
评论列表
文章目录