def test_get_expanded_names_including_omitted_when_defer_to_next_level(self): serializer = FlexFieldsModelSerializer() serializer.expandable_fields = {"cat": "field", "dog": "field"} result = serializer._get_expanded_field_names( ["cat"], ["cat"], [], {"cat": ["age"]} ) self.assertEqual(result, ["cat"])
def test_get_expanded_names_but_only_sparse(self): serializer = FlexFieldsModelSerializer() serializer.expandable_fields = {"cat": "field", "dog": "field"} result = serializer._get_expanded_field_names(["cat"], [], ["cat"], {}) self.assertEqual(result, ["cat"])
def test_get_expanded_field_names_if_all(self): serializer = FlexFieldsModelSerializer() serializer.expandable_fields = {"cat": "field", "dog": "field"} result = serializer._get_expanded_field_names("*", [], [], {}) self.assertEqual(result, ["cat", "dog"])