def test_as_dict_includes_expected_fields(self): prop = Property("foo", "desc", max_cardinality=3) prop.add_enum_value("steve") prop.add_enum_value("stove") expected_fields = { 'description': 'desc', 'oneOf': ['steve', 'stove'], 'type': 'array', 'items': {'type': 'string'}, 'maxItems': 3, } dictified = prop.as_dict() for expected_field, expected_value in expected_fields.items(): self.assertIn(expected_field, dictified) self.assertEqual(dictified[expected_field], expected_value)
def test_as_dict_always_includes_description_even_if_blank(self): prop = Property("foo", "", max_cardinality=3) self.assertIn('description', prop.as_dict())