test_zipupload.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:DCRM 作者: 82Flex 项目源码 文件源码
def test_good_data(self):
        """Upload a zip with a single file it it: 'sample.jpg'.
        It gets assigned to a newly created gallery 'Test'."""

        test_data = copy.copy(self.sample_form_data)
        response = self.client.post('/admin/photologue/photo/upload_zip/', test_data)
        # The redirect Location has changed in Django 1.9 - it used to be an absolute URI, now it returns
        # a relative one.
        if VERSION[0] == 1 and VERSION[1] <= 8:
            location = 'http://testserver/admin/photologue/photo/'
        else:
            location = '..'

        self.assertEqual(response['Location'], location)

        self.assertQuerysetEqual(Gallery.objects.all(),
                                 ['<Gallery: This is a test title>'])
        self.assertQuerysetEqual(Photo.objects.all(),
                                 ['<Photo: This is a test title 1>'])

        # The photo is attached to the gallery.
        gallery = Gallery.objects.get(title='This is a test title')
        self.assertQuerysetEqual(gallery.photos.all(),
                                 ['<Photo: This is a test title 1>'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号