def test_request_failure(self, mock_post): mock_post.return_value = MockResponse(400, '{"errors":["Bad request", "Doh!"]}') flow = self.get_flow("color") contact = self.create_contact("Joe", number="+29638356667") with self.assertRaises(FlowServerException) as e: self.client.request_builder(self.org).start_manual(contact, flow) self.assertEqual( e.exception.as_json(), {"endpoint": "start", "request": matchers.Dict(), "response": {"errors": ["Bad request", "Doh!"]}}, )
def test_request_failure(self): flow = self.get_flow("color") with patch("requests.post") as mock_post: mock_post.return_value = MockResponse(400, '{"errors":["Bad request", "Doh!"]}') with self.assertRaises(MailroomException) as e: get_client().flow_migrate(flow.get_definition()) self.assertEqual( e.exception.as_json(), {"endpoint": "flow/migrate", "request": matchers.Dict(), "response": {"errors": ["Bad request", "Doh!"]}}, )
def test_request_failure(self, mock_post): mock_post.return_value = MockResponse( 400, '{"errors":["Bad request", "Doh!"]}') flow = self.get_flow("color") with self.assertRaises(FlowServerException) as e: serialize_flow(flow) self.assertEqual( e.exception.as_json(), { "endpoint": "migrate", "request": matchers.Dict(), "response": { "errors": ["Bad request", "Doh!"] } }, )