Esempio n. 1
0
    def test_exception_to_validation_legacy(self):
        json_error = """400 Bad Request

The server could not comply with the request since it is either \
malformed or otherwise incorrect.

 Remote error: StackValidationFailed The Key (none) could not be found. \
[u'<Traceback>']."""

        msg = forms.exception_to_validation_msg(json_error)
        self.assertEqual(msg, "The Key (none) could not be found.")
Esempio n. 2
0
    def test_exception_to_validation_legacy(self):
        json_error = """400 Bad Request

The server could not comply with the request since it is either \
malformed or otherwise incorrect.

 Remote error: StackValidationFailed The Key (none) could not be found. \
[u'<Traceback>']."""

        msg = forms.exception_to_validation_msg(json_error)
        self.assertEqual(msg, "The Key (none) could not be found.")
Esempio n. 3
0
    def test_exception_to_validation_malformed(self):
        json_error = """{
    "code": 400,
    "error": {
        "traceback": "<Traceback>",
        "type": "StackValidationFailed"
    },
    "explanation": "The server could not comply with the request",
    "title": "Bad Request"
}"""

        msg = forms.exception_to_validation_msg(json_error)
        self.assertEqual(msg, None)
Esempio n. 4
0
    def test_exception_to_validation_malformed(self):
        json_error = """{
    "code": 400,
    "error": {
        "traceback": "<Traceback>",
        "type": "StackValidationFailed"
    },
    "explanation": "The server could not comply with the request",
    "title": "Bad Request"
}"""

        msg = forms.exception_to_validation_msg(json_error)
        self.assertIsNone(msg)
Esempio n. 5
0
    def test_exception_to_validation(self):
        json_error = """{
    "code": 400,
    "error": {
        "message": "The Key (none) could not be found.",
        "traceback": "<Traceback>",
        "type": "StackValidationFailed"
    },
    "explanation": "The server could not comply with the request",
    "title": "Bad Request"
}"""

        msg = forms.exception_to_validation_msg(json_error)
        self.assertEqual(msg, "The Key (none) could not be found.")