def test_get_objects(self, not_command, not_note, not_credential, not_service, not_vuln, not_host): obj_sign_to_mock = {'hosts': not_host, 'vulns': not_vuln, 'services': not_service, 'credentials': not_credential, 'notes': not_note, 'commands': not_command} for obj_sign in obj_sign_to_mock.keys(): server.get_objects('a', obj_sign) obj_sign_to_mock[obj_sign].assert_called_once_with('a') with self.assertRaises(server_io_exceptions.WrongObjectSignature): server.get_objects('a', 'not a signature')
def test_get_objects(self, not_command, not_note, not_credential, not_service, not_interface, not_vuln, not_host): obj_sign_to_mock = { "hosts": not_host, "vulns": not_vuln, "interfaces": not_interface, "services": not_service, "credentials": not_credential, "notes": not_note, "commands": not_command, } for obj_sign in obj_sign_to_mock.keys(): server.get_objects("a", obj_sign) obj_sign_to_mock[obj_sign].assert_called_once_with("a") with self.assertRaises(utils.WrongObjectSignature): server.get_objects("a", "not a signature")