def test_formats(self, *args): self.storage = dropbox.DropBoxStorage('foo') files = self.storage._full_path('') self.assertEqual(files, self.storage._full_path('/')) self.assertEqual(files, self.storage._full_path('.')) self.assertEqual(files, self.storage._full_path('..')) self.assertEqual(files, self.storage._full_path('../..'))
def test_timeout_config(self, Dropbox): token = 'abc' timeout = 60 with self.settings(DROPBOX_OAUTH2_TOKEN=token, DROPBOX_TIMEOUT=timeout): dropbox.DropBoxStorage() Dropbox.assert_called_with(token, timeout) with self.settings(DROPBOX_OAUTH2_TOKEN=token): dropbox.DropBoxStorage(timeout=timeout) Dropbox.assert_called_with(token, timeout) with self.settings(DROPBOX_OAUTH2_TOKEN=token): dropbox.DropBoxStorage() Dropbox.assert_called_with(token)
def setUp(self, *args): self.storage = dropbox.DropBoxStorage('')
def setUp(self, *args): self.storage = dropbox.DropBoxStorage('') self.file = dropbox.DropBoxFile('/foo.txt', self.storage)
def test_no_access_token(self, *args): with self.assertRaises(ImproperlyConfigured): dropbox.DropBoxStorage(None)
def test_suspicious(self, *args): self.storage = dropbox.DropBoxStorage('foo', '/bar') with self.assertRaises((SuspiciousFileOperation, ValueError)): self.storage._full_path('..')
def test_jailed(self, *args): self.storage = dropbox.DropBoxStorage('foo', '/bar') dirs, files = self.storage.listdir('/') self.assertFalse(dirs) self.assertFalse(files)
def get_resume_temporary_download_link(self): if self.resume: from storages.backends import dropbox as file_storage dbox = file_storage.DropBoxStorage() return dbox.url(self.resume.name)