tests.py 文件源码

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

项目:higlass-server 作者: hms-dbmi 项目源码 文件源码
def test_upload_file(self):
        c = dt.Client()
        c.login(username='user1', password='pass')

        f = open('data/tiny.txt', 'rb')

        response = c.post(
            '/api/v1/tilesets/',
            {
                'datafile': f,
                'filetype': 'hitile',
                'datatype': 'vector',
                'uid': 'bb',
                'private': 'True',
                'coordSystem': 'hg19'
            },
            format='multipart'
        )

        if hss.UPLOAD_ENABLED:
            self.assertEqual(rfs.HTTP_201_CREATED, response.status_code)

            response = c.get('/api/v1/tilesets/')

            obj = tm.Tileset.objects.get(uuid='bb')

            # make sure the file was actually created
            self.assertTrue(op.exists, obj.datafile.url)
        else:
            self.assertEqual(403, response.status_code)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号