Example #1
0
    def test_empty_slurp_list(self):
        mock_sts().start()

        watcher = IAMRole(accounts=[self.account.name])
        watcher.list_method = lambda **kwargs: []

        _, exceptions = watcher.slurp_list()
        assert len(exceptions) == 0
        assert len(watcher.total_list) == 0
        assert watcher.done_slurping
Example #2
0
    def test_empty_slurp_list(self):
        mock_sts().start()

        watcher = IAMRole(accounts=[self.account.name])
        watcher.list_method = lambda **kwargs: []

        _, exceptions = watcher.slurp_list()
        assert len(exceptions) == 0
        assert len(watcher.total_list) == 0
        assert watcher.done_slurping

        mock_sts().stop()
Example #3
0
    def test_slurp_list_exceptions(self):
        mock_sts().start()

        watcher = IAMRole(accounts=[self.account.name])

        def raise_exception():
            raise Exception("LOL, HAY!")

        watcher.list_method = lambda **kwargs: raise_exception()

        _, exceptions = watcher.slurp_list()
        assert len(exceptions) == 1
        assert len(ExceptionLogs.query.all()) == 1
Example #4
0
    def test_slurp_list_exceptions(self):
        mock_sts().start()

        watcher = IAMRole(accounts=[self.account.name])

        def raise_exception():
            raise Exception("LOL, HAY!")

        watcher.list_method = lambda **kwargs: raise_exception()

        _, exceptions = watcher.slurp_list()
        assert len(exceptions) == 1
        assert len(ExceptionLogs.query.all()) == 1

        mock_sts().stop()