This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new 5b683f0 Improve test coverage for test_common_schema.py (#10740)
5b683f0 is described below
commit 5b683f09c0fffd781111c1a8268ed41b1abfd6e0
Author: Kaxil Naik <[email protected]>
AuthorDate: Sat Sep 5 07:53:43 2020 +0100
Improve test coverage for test_common_schema.py (#10740)
Adds test that an error is raised with specific message when unkown object
type is passed
---
tests/api_connexion/schemas/test_common_schema.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/api_connexion/schemas/test_common_schema.py
b/tests/api_connexion/schemas/test_common_schema.py
index 8ea8f7e..c6cecdb 100644
--- a/tests/api_connexion/schemas/test_common_schema.py
+++ b/tests/api_connexion/schemas/test_common_schema.py
@@ -135,9 +135,15 @@ class TestScheduleIntervalSchema(unittest.TestCase):
expected_instance = relativedelta.relativedelta(days=+12)
self.assertEqual(expected_instance, result)
- def test_should_serialize_cron_expresssion(self):
+ def test_should_serialize_cron_expression(self):
instance = "5 4 * * *"
schema_instance = ScheduleIntervalSchema()
result = schema_instance.dump(instance)
expected_instance = {"__type": "CronExpression", "value": "5 4 * * *"}
self.assertEqual(expected_instance, result)
+
+ def test_should_error_unknown_obj_type(self):
+ instance = 342
+ schema_instance = ScheduleIntervalSchema()
+ with self.assertRaisesRegex(Exception, "Unknown object type: int"):
+ schema_instance.dump(instance)