def test_get_fields_no_renaming(self): """ Test get_fields() returns original fields if no renaming is done. """ group_by = GroupBy( query_param="test", fields=("id", "name"), queryset=self.queryset, ) self.assertEqual(group_by.get_fields(), group_by.fields)
def test_get_fields_with_partly_renaming(self): """ Test get_fields() returns renamed fields when renaming only part of the fields. """ group_by = GroupBy( query_param="test", fields=("id", "name"), renamed_fields="id_renamed", queryset=self.queryset, ) self.assertItemsEqual(group_by.get_fields(), ["id_renamed", "name"])
def test_get_fields_with_renaming(self): """ Test get_fields() returns renamed fields when renaming. """ group_by = GroupBy( query_param="test", fields=("id", "name"), renamed_fields=("id_renamed", "name_renamed"), queryset=self.queryset, ) self.assertEqual(group_by.get_fields(), group_by.renamed_fields)