diff --git a/storages/backends/dropbox.py b/storages/backends/dropbox.py index b8512b9a1..e520b3886 100644 --- a/storages/backends/dropbox.py +++ b/storages/backends/dropbox.py @@ -101,7 +101,7 @@ def accessed_time(self, name): def url(self, name): media = self.client.files_get_temporary_link(self._full_path(name)) - return media['link'] + return media.link def _open(self, name, mode='rb'): remote_file = DropBoxFile(self._full_path(name), self) diff --git a/tests/test_dropbox.py b/tests/test_dropbox.py index ad581a5dd..342a7d042 100644 --- a/tests/test_dropbox.py +++ b/tests/test_dropbox.py @@ -14,6 +14,10 @@ import mock +class F(object): + pass + + FILE_DATE = datetime(2015, 8, 24, 15, 6, 41) FILE_FIXTURE = { 'bytes': 4, @@ -52,10 +56,8 @@ 'size': '0 bytes', 'thumb_exists': False } -FILE_MEDIA_FIXTURE = { - 'link': 'https://dl.dropboxusercontent.com/1/view/foo', - 'expires': 'Fri, 16 Sep 2011 01:01:25 +0000', -} +FILE_MEDIA_FIXTURE = F() +FILE_MEDIA_FIXTURE.link = 'https://dl.dropboxusercontent.com/1/view/foo' class DropBoxTest(TestCase): @@ -123,7 +125,7 @@ def test_save(self, *args): return_value=FILE_MEDIA_FIXTURE) def test_url(self, *args): url = self.storage.url('foo') - self.assertEqual(url, FILE_MEDIA_FIXTURE['link']) + self.assertEqual(url, FILE_MEDIA_FIXTURE.link) def test_formats(self, *args): self.storage = dropbox.DropBoxStorage('foo')