test_realm: Fix `test_invalid_integer_attribute_values`.

Fixes test that checks for error when invalid value is given for a property
in realm. Currently, only properties with type int are checked, leaving
properties having optional int type. This commit fixes that.
This commit is contained in:
Vector73 2024-09-09 23:32:22 +05:30 committed by Tim Abbott
parent 8bacdbc895
commit eacf54d52d
1 changed files with 4 additions and 1 deletions

View File

@ -839,7 +839,9 @@ class RealmTest(ZulipTestCase):
self.assertFalse(realm.deactivated)
def test_invalid_integer_attribute_values(self) -> None:
integer_values = [key for key, value in Realm.property_types.items() if value is int]
integer_values = [
key for key, value in Realm.property_types.items() if value in (int, (int, type(None)))
]
invalid_values = dict(
bot_creation_policy=10,
@ -879,6 +881,7 @@ class RealmTest(ZulipTestCase):
f"Bad value for '{val_name}': {invalid_val}",
f"Invalid {val_name} {invalid_val}",
f"{val_name} is too small",
"Must be an organization owner",
}
req = {val_name: invalid_val}