def test_parse_as_slugs_many(self): addon2 = addon_factory() field = SlugOrPrimaryKeyRelatedField(queryset=Addon.objects.all(), many=True) assert field.to_internal_value([self.addon.slug, addon2.slug]) == [ self.addon, addon2, ]
def test_parse_as_slugs_many(self): addon2 = addon_factory() field = SlugOrPrimaryKeyRelatedField(queryset=Addon.objects.all(), many=True) assert (field.to_internal_value([self.addon.slug, addon2.slug]) == [self.addon, addon2])
def test_parse_as_slug(self): field = SlugOrPrimaryKeyRelatedField(queryset=Addon.objects.all()) assert field.to_internal_value(self.addon.slug) == self.addon
def test_parse_as_slug(self): field = SlugOrPrimaryKeyRelatedField(queryset=Addon.objects.all()) assert field.to_internal_value(self.addon.slug) == self.addon