示例#1
0
文件: tasks.py 项目: rodo/calorine
    def test_importupload_success(self):
        """
        Simple upload

        Assume all is ok
        """
        http = TestServer()
        http.start()
        url = 'http://127.0.0.1:%d/progress-url-test' % (http.port)

        Upload.objects.all().delete()

        fpath = os.path.join(os.path.dirname(__file__),
                             'samples',
                             'first',
                             'test.ogg')

        newpath = move_file(fpath, 'toto.ogg')

        upl = Upload.objects.create(uuid='123456789',
                                    user=self.user,
                                    path=newpath,
                                    filename='The Healing Game.ogg',
                                    content_type='application/ogg')

        result = import_upload(upl.uuid, 2, url)

        self.assertEqual(result['state'], 'done')
示例#2
0
文件: tasks.py 项目: rodo/calorine
    def test_getuploadstatus(self):
        """
        Function : get_upload_status()
        """
        http = TestServer()
        http.start()
        url = 'http://127.0.0.1:%d/progress-url-test' % (http.port)

        datas = get_upload_status("fakeuuid", url)

        self.assertEqual(datas['state'], 'done')