Esempio n. 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)
Esempio n. 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)
Esempio n. 3
0
    def test_to_json_with_no_errors(self):
        e = ValidationError("Boom")

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

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