def test_list_repoable_services( self, mock_find_role_in_cache, mock_role_fetch, mock_get_services_and_permissions_from_repoable, ): mock_find_role_in_cache.side_effect = [None, "ROLE_ID_A"] mock_get_services_and_permissions_from_repoable.return_value = { "foo", "bar" } success, _ = dispatcher.list_repoable_services(MESSAGE) assert not success mock_find_role_in_cache.assert_called_once() mock_role_fetch.assert_not_called() mock_get_services_and_permissions_from_repoable.assert_not_called() mock_role_fetch.reset_mock() mock_get_services_and_permissions_from_repoable.reset_mock() mock_find_role_in_cache.reset_mock() success, _ = dispatcher.list_repoable_services(MESSAGE) assert success mock_find_role_in_cache.assert_called_once() mock_role_fetch.assert_called_once() mock_get_services_and_permissions_from_repoable.assert_called_once()
def test_list_repoable_services(self, mock_get_role_data, mock_find_role_in_cache): mock_find_role_in_cache.side_effect = [None, 'ROLE_ID_A'] (success, _) = dispatcher.list_repoable_services(DYNAMO_TABLE, MESSAGE) assert not success (success, _) = dispatcher.list_repoable_services(DYNAMO_TABLE, MESSAGE) assert success
def test_list_role_rollbacks(self, mock_find_role_in_cache, mock_role_fetch): mock_find_role_in_cache.side_effect = [None, "ROLE_ID_A"] (success, _) = dispatcher.list_role_rollbacks(MESSAGE) assert not success mock_find_role_in_cache.assert_called_once() mock_role_fetch.assert_not_called() mock_role_fetch.reset_mock() mock_find_role_in_cache.reset_mock() (success, _) = dispatcher.list_repoable_services(MESSAGE) assert success mock_find_role_in_cache.assert_called_once() mock_role_fetch.assert_called_once()