def test_get_non_existent_domain(self): with patch.object(self.qs.connection, 'describe_domain') as mock: with self.assertRaises(DoesNotExistError): mock.side_effect = SWFResponseError( 400, "mocking exception", {'__type': 'UnknownResourceFault'}) self.qs.get('non_existent')
def test_get_domain_with_invalid_credentials(self): with patch.object(self.qs.connection, 'describe_domain') as mock: with self.assertRaises(InvalidCredentialsError): mock.side_effect = SWFResponseError( 400, "mocking exception", {'__type': 'UnrecognizedClientException'}) self.qs.get('non_existent')
def test_domain_exists_with_whatever_error(self): with patch.object(self.domain.connection, 'describe_domain') as mock: with self.assertRaises(ResponseError): mock.side_effect = SWFResponseError(400, "mocking exception", { '__type': 'WhateverError', 'message': 'Whatever' }) dummy = self.domain.exists
def test_delete_non_existent_type(self): with patch.object(self.wt.connection, 'deprecate_workflow_type') as mock: with self.assertRaises(DoesNotExistError): mock.side_effect = SWFResponseError(400, "mocked exception", { "__type": "UnknownResourceFault", "message": "Whatever" }) self.wt.delete()
def test_get_with_non_existent_version(self): """Asserts get method with non existent activity type version provided raises""" with patch.object(self.atq.connection, "describe_activity_type") as mock: with self.assertRaises(DoesNotExistError): mock.side_effect = SWFResponseError( 400, "mocking exception", {"__type": "UnknownResourceFault"}) self.atq.get("mocked-non-existent-activity-type-name", "na")
def test_get_with_non_existent_name(self): """Asserts get method with non existent activity type name provided raises""" with patch.object(self.atq.connection, 'describe_activity_type') as mock: with self.assertRaises(DoesNotExistError): mock.side_effect = SWFResponseError( 400, 'mocking exception', {'__type': 'UnknownResourceFault'}) self.atq.get('mocked-non-existent-activity-type-name', '0.1')
def test_get_raising_domain(self): with patch.object(self.qs.connection, "describe_domain") as mock: with self.assertRaises(ResponseError): mock.side_effect = SWFResponseError( 400, "mocking exception", {"__type": "WhateverError", "message": "WhateverMessage",}, ) self.qs.get("whatever")
def test_save_with_response_error(self): with patch.object(self.wt.connection, "register_workflow_type") as mock: with self.assertRaises(DoesNotExistError): mock.side_effect = SWFResponseError( 400, "mocked exception", {"__type": "UnknownResourceFault", "message": "Whatever"}, ) self.wt.save()
def test_delete_deprecated_type(self): with patch.object(self.wt.connection, "deprecate_workflow_type") as mock: with self.assertRaises(DoesNotExistError): mock.side_effect = SWFResponseError( 400, "mocked exception", {"__type": "TypeDeprecatedFault", "message": "Whatever"}, ) self.wt.delete()
def test_get_raising_domain(self): with patch.object(self.qs.connection, 'describe_domain') as mock: with self.assertRaises(ResponseError): mock.side_effect = SWFResponseError( 400, "mocking exception", { '__type': 'WhateverError', 'message': 'WhateverMessage', }) self.qs.get('whatever')
def test_get_non_existent_workflow_type(self): with patch.object(self.wtq.connection, 'describe_workflow_type') as mock: with self.assertRaises(DoesNotExistError): mock.side_effect = SWFResponseError(400, "mocked exception", { "__type": "UnknownResourceFault", "message": "Whatever", }) self.wtq.get("NonExistentWorkflowType", "0.1")
def test_get_whatever_failing_workflow_type(self): with patch.object(self.wtq.connection, 'describe_workflow_type') as mock: with self.assertRaises(ResponseError): mock.side_effect = SWFResponseError(400, "mocked exception", { "__type": "Whatever Error", "message": "Whatever", }) self.wtq.get("NonExistentWorkflowType", "0.1")
def test_get_invalid_workflow_execution(self): with patch.object(self.weq.connection, 'describe_workflow_execution') as mock: with self.assertRaises(ResponseError): mock.side_effect = SWFResponseError(400, "mocked exception", { "__type": "WhateverFault", "message": "Whatever", }) self.weq.get("mocked-workflow-id", "mocked-run-id")
def test_workflow_execution_exists_with_whatever_error(self): with patch.object(self.we.connection, "describe_workflow_execution") as mock: with self.assertRaises(ResponseError): mock.side_effect = SWFResponseError( 400, "mocking exception", {"__type": "WhateverError", "message": "Whatever"}, ) dummy = self.domain.exists
def test_get_with_failing_activity_type(self): """Asserts get method over a failing activity type raises""" with patch.object(self.atq.connection, 'describe_activity_type') as mock: with self.assertRaises(ResponseError): mock.side_effect = SWFResponseError( 400, 'mocking exception', {'__type': 'UnrecognizedClientException'}) self.atq.get('mocked-failing-activity-type', '0.1')
def test_get_with_failing_activity_type(self): """Asserts get method over a failing activity type raises""" with patch.object(self.atq.connection, "describe_activity_type") as mock: with self.assertRaises(ResponseError): mock.side_effect = SWFResponseError( 400, "mocking exception", {"__type": "UnrecognizedClientException"}) self.atq.get("mocked-failing-activity-type", "0.1")
def test_exists_with_non_existent_workflow_type(self): with patch.object(self.wt.connection, 'describe_workflow_type') as mock: mock.side_effect = SWFResponseError( 400, "Bad Request:", {'__type': 'com.amazonaws.swf.base.model#UnknownResourceFault', 'message': 'Unknown type: WorkflowType=[workflowId=blah, runId=test]'}, 'UnknownResourceFault', ) self.assertFalse(self.wt.exists)
def test_domain_delete_non_existent_domain(self): with patch.object(self.domain.connection, "deprecate_domain") as mock: with self.assertRaises(DomainDoesNotExist): mock.side_effect = SWFResponseError( 400, "Bad Request", { "message": "Unknown domain: does not exist", "__type": "com.amazonaws.swf.base.model#UnknownResourceFault", }, "UnknownResourceFault", ) self.domain.delete()
def test_get_non_existent_workflow_execution(self): with patch.object(self.weq.connection, "describe_workflow_execution") as mock: with self.assertRaises(DoesNotExistError): mock.side_effect = SWFResponseError( 400, "mocked exception", { "__type": "UnknownResourceFault", "message": "Whatever", }, ) self.weq.get("mocked-workflow-id", "mocked-run-id")
def test_exists_with_non_existent_workflow_execution(self): with patch.object(self.we.connection, "describe_workflow_execution") as mock: mock.side_effect = SWFResponseError( 400, "Bad Request:", { "__type": "com.amazonaws.swf.base.model#UnknownResourceFault", "message": "Unknown execution: WorkflowExecution=[workflowId=blah, runId=test]", }, "UnknownResourceFault", ) self.assertFalse(self.we.exists)
def test_domain_exists_with_non_existent_domain(self): with patch.object(self.domain.connection, "describe_domain") as mock: mock.side_effect = SWFResponseError( 400, "Bad Request", { "message": "Unknown domain: does not exist", "__type": "com.amazonaws.swf.base.model#UnknownResourceFault", }, "UnknownResourceFault", ) self.assertFalse(self.domain.exists)