Example #1
0
    def test_to_json_with_extras(self):
        e = ValidationError("Boom", errors={"key": "value"}, foo="bar")

        expected_dict = {
            "reason": "Boom",
            "foo": "bar",
            "errors": {"key": "value"}
        }

        self.assertDictEqual(e.to_json(), expected_dict)
Example #2
0
    def test_to_json_with_extras(self):
        e = ValidationError("Boom", errors={"key": "value"}, foo="bar")

        expected_dict = {
            "reason": "Boom",
            "foo": "bar",
            "errors": {
                "key": "value"
            }
        }

        self.assertDictEqual(e.to_json(), expected_dict)
Example #3
0
    def test_to_json_with_no_errors(self):
        e = ValidationError("Boom")

        self.assertEqual(e.to_json(), {"reason": "Boom"})
Example #4
0
    def test_to_json_with_no_errors(self):
        e = ValidationError("Boom")

        self.assertEqual(e.to_json(), {"reason": "Boom"})