示例#1
0
 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())
示例#2
0
 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())
示例#3
0
 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()
示例#4
0
 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'))
示例#5
0
 def test_get_canonical_path(self):
     rsrc_key = DogSerializer().get_resource_key()
     self.assertEqual('/dogs', DynamicRouter.get_canonical_path(rsrc_key))