pass def audit_all_objects(self): RUNTIME_AUDITORS[self.__class__.__name__].append(self) def save_issues(self): pass def applies_to_account(self, account): return True mock_query = MockAccountQuery() mock_db_session = MockDBSession() test_account = Account() test_account.name = "TEST_ACCOUNT" test_account.notes = "TEST ACCOUNT" test_account.s3_name = "TEST_ACCOUNT" test_account.number = "012345678910" test_account.role_name = "TEST_ACCOUNT" test_account.account_type = AccountType(name='AWS') test_account.third_party = False test_account.active = True mock_query.add_account(test_account) test_account2 = Account() test_account2.name = "TEST_ACCOUNT2"
.. version:: $$VERSION$$ .. moduleauthor:: Bridgewater OSS <*****@*****.**> """ from security_monkey.tests import SecurityMonkeyTestCase from security_monkey.watchers.ec2.ec2_image import EC2Image from security_monkey.datastore import Account from security_monkey.tests.db_mock import MockAccountQuery import boto3 from moto import mock_sts, mock_ec2 from freezegun import freeze_time from mock import patch mock_query = MockAccountQuery() class EC2ImageWatcherTestCase(SecurityMonkeyTestCase): @freeze_time("2016-07-18 12:00:00") @mock_sts @mock_ec2 @patch('security_monkey.datastore.Account.query', new=mock_query) def test_slurp(self): test_account = Account() test_account.name = "TEST_ACCOUNT" test_account.notes = "TEST ACCOUNT" test_account.s3_name = "TEST_ACCOUNT" test_account.number = "012345678910" test_account.role_name = "TEST_ACCOUNT"
return item_list, exception_map def save(self): pass def audit_all_objects(self): RUNTIME_AUDITORS[self.__class__.__name__].append(self) def save_issues(self): pass mock_query = MockAccountQuery() mock_db_session = MockDBSession() test_account = Account() test_account.name = "TEST_ACCOUNT" test_account.notes = "TEST ACCOUNT" test_account.s3_name = "TEST_ACCOUNT" test_account.number = "012345678910" test_account.role_name = "TEST_ACCOUNT" test_account.third_party = False test_account.active = True mock_query.add_account(test_account) test_account2 = Account() test_account2.name = "TEST_ACCOUNT2" test_account2.notes = "TEST ACCOUNT2"