예제 #1
0
 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)
예제 #3
0
 def setUp(self, *args):
     self.storage = dropbox.DropBoxStorage('')
예제 #4
0
 def setUp(self, *args):
     self.storage = dropbox.DropBoxStorage('')
     self.file = dropbox.DropBoxFile('/foo.txt', self.storage)
예제 #5
0
 def test_no_access_token(self, *args):
     with self.assertRaises(ImproperlyConfigured):
         dropbox.DropBoxStorage(None)
예제 #6
0
 def test_suspicious(self, *args):
     self.storage = dropbox.DropBoxStorage('foo', '/bar')
     with self.assertRaises((SuspiciousFileOperation, ValueError)):
         self.storage._full_path('..')
예제 #7
0
 def test_jailed(self, *args):
     self.storage = dropbox.DropBoxStorage('foo', '/bar')
     dirs, files = self.storage.listdir('/')
     self.assertFalse(dirs)
     self.assertFalse(files)
예제 #8
0
 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)