def test_default_plural_name(self): serializer = DogSerializer() if hasattr(serializer.Meta, 'plural_name'): # bust cached value del (serializer.Meta.plural_name) self.assertFalse(hasattr(serializer.Meta, 'plural_name')) self.assertEqual('dogs', serializer.get_plural_name())
def test_default_plural_name(self): serializer = DogSerializer() if hasattr(serializer.Meta, 'plural_name'): # bust cached value del(serializer.Meta.plural_name) self.assertFalse(hasattr(serializer.Meta, 'plural_name')) self.assertEqual('dogs', serializer.get_plural_name())
def test_get_canonical_path_with_prefix(self): set_script_prefix('/v2/') rsrc_key = DogSerializer().get_resource_key() self.assertEqual( '/v2/dogs', DynamicRouter.get_canonical_path(rsrc_key) ) clear_script_prefix()
def test_get_canonical_path_with_pk(self): rsrc_key = DogSerializer().get_resource_key() self.assertEqual('/dogs/1/', DynamicRouter.get_canonical_path(rsrc_key, pk='1'))
def test_get_canonical_path(self): rsrc_key = DogSerializer().get_resource_key() self.assertEqual('/dogs', DynamicRouter.get_canonical_path(rsrc_key))