Esempio n. 1
0
    def test_can_get(self):
        self.login_as(self.admin)
        resp = self.client.get(self.url)

        json_resp = json.loads(resp.content)
        assert '8082' in json_resp['upload_link']
        assert 'upload' in json_resp['upload_link']

        # test upload file via `upload_link`
        upload_file_test(json_resp['upload_link'])
Esempio n. 2
0
    def test_get_upload_link(self):

        token = self._add_upload_link()

        url = reverse('api-v2.1-upload-link-upload', args=[token])
        resp = self.client.get(url)

        self.assertEqual(200, resp.status_code)
        json_resp = json.loads(resp.content)
        assert '8082' in json_resp['upload_link']
        assert 'upload' in json_resp['upload_link']

        # test upload file via `upload_link`
        upload_file_test(json_resp['upload_link'])

        self._remove_upload_link(token)
Esempio n. 3
0
    def test_upload(self):
        self.login_as(self.admin)
        token = self._add_upload_link()

        url = reverse('api-v2.1-admin-upload-link-upload', args=[token])
        resp = self.client.get(url)
        self.assertEqual(200, resp.status_code)

        json_resp = json.loads(resp.content)

        assert '8082' in json_resp['upload_link']
        assert 'upload' in json_resp['upload_link']

        # test upload file via `upload_link`
        upload_file_test(json_resp['upload_link'], parent_dir=self.folder_path)

        self._remove_upload_link(token)