Ejemplo n.º 1
0
    def test_lambda_failure_response(self, jsonify_patch, make_response_patch):
        jsonify_patch.return_value = {"json": "Response"}
        make_response_patch.return_value = {"Some Response"}

        response = ServiceErrorResponses.lambda_failure_response()

        self.assertEqual(response, {"Some Response"})

        jsonify_patch.assert_called_with({"message": "Internal server error"})
        make_response_patch.assert_called_with({"json": "Response"}, 502)
    def test_lambda_failure_response(self, jsonify_patch, make_response_patch):
        jsonify_patch.return_value = {"json": "Response"}
        make_response_patch.return_value = {"Some Response"}

        response = ServiceErrorResponses.lambda_failure_response()

        self.assertEquals(response, {"Some Response"})

        jsonify_patch.assert_called_with({"message": "Internal server error"})
        make_response_patch.assert_called_with({"json": "Response"}, 502)
Ejemplo n.º 3
0
    def test_route_not_found(self, jsonify_patch, make_response_patch):
        jsonify_patch.return_value = {"json": "Response"}
        make_response_patch.return_value = {"Some Response"}
        error_mock = Mock()

        response = ServiceErrorResponses.route_not_found(error_mock)

        self.assertEqual(response, {"Some Response"})

        jsonify_patch.assert_called_with({"message": "Missing Authentication Token"})
        make_response_patch.assert_called_with({"json": "Response"}, 403)
Ejemplo n.º 4
0
    def test_lambda_not_found_response(self, jsonify_patch, make_response_patch):
        jsonify_patch.return_value = {"json": "Response"}
        make_response_patch.return_value = {"Some Response"}
        error_mock = Mock()

        response = ServiceErrorResponses.lambda_not_found_response(error_mock)

        self.assertEqual(response, {"Some Response"})

        jsonify_patch.assert_called_with({"message": "No function defined for resource method"})
        make_response_patch.assert_called_with({"json": "Response"}, 502)
    def test_route_not_found(self, jsonify_patch, make_response_patch):
        jsonify_patch.return_value = {"json": "Response"}
        make_response_patch.return_value = {"Some Response"}
        error_mock = Mock()

        response = ServiceErrorResponses.route_not_found(error_mock)

        self.assertEquals(response, {"Some Response"})

        jsonify_patch.assert_called_with({"message": "Missing Authentication Token"})
        make_response_patch.assert_called_with({"json": "Response"}, 403)
    def test_lambda_not_found_response(self, jsonify_patch, make_response_patch):
        jsonify_patch.return_value = {"json": "Response"}
        make_response_patch.return_value = {"Some Response"}
        error_mock = Mock()

        response = ServiceErrorResponses.lambda_not_found_response(error_mock)

        self.assertEquals(response, {"Some Response"})

        jsonify_patch.assert_called_with({"message": "No function defined for resource method"})
        make_response_patch.assert_called_with({"json": "Response"}, 502)