test theme validator

This commit is contained in:
Sina Atalay 2023-10-13 22:42:28 +02:00
parent 1c531e6f76
commit a9d68652a0
1 changed files with 17 additions and 0 deletions

View File

@ -101,6 +101,23 @@ class TestDataModel(unittest.TestCase):
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
data_model.Design(**input) # type: ignore data_model.Design(**input) # type: ignore
def test_data_design_theme(self):
# Valid theme:
input = {
"theme": "classic",
}
with self.subTest(msg="valid theme"):
design = data_model.Design(**input) # type: ignore
self.assertEqual(design.theme, input["theme"])
# Nonexistent theme:
input = {
"theme": "nonexistent",
}
with self.subTest(msg="nonexistent theme"):
with self.assertRaises(ValidationError):
data_model.Design(**input) # type: ignore
def test_data_event_check_dates(self): def test_data_event_check_dates(self):
# Inputs with valid dates: # Inputs with valid dates:
input = { input = {