Skip to content

Commit

Permalink
Fix DropBoxBackend.url
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneier committed Jul 7, 2017
1 parent a92e7a6 commit eb1686d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
django-storages change log
==========================

1.6.4 (XXXX-XX-XX)
******************

* Fix ``DropBoxStorage.url`` to work. (`#357`_)

.. _#357: https://github.com/jschneier/django-storages/pull/357

1.6.3 (2017-06-23)
******************

Expand Down
2 changes: 1 addition & 1 deletion storages/backends/dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions tests/test_dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import mock


class F(object):
pass


FILE_DATE = datetime(2015, 8, 24, 15, 6, 41)
FILE_FIXTURE = {
'bytes': 4,
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit eb1686d

Please sign in to comment.