tests.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:openbare 作者: openbare 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号