Skip to content

Commit

Permalink
Merge pull request #172 from bradleyg/digital-ocean-support
Browse files Browse the repository at this point in the history
Formatting.
  • Loading branch information
bradleyg authored Jan 31, 2019
2 parents 9e997f5 + ea1bf53 commit bcfb1ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 5 additions & 8 deletions s3direct/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ def test_widget_html(self):
self.assertEqual(widget.render('filename', None), expected)

def test_missing_dest(self):
data = {
'name': 'image.jpg',
'type': 'image/jpeg',
'size': 1000
}
data = {'name': 'image.jpg', 'type': 'image/jpeg', 'size': 1000}
response = self.client.post(reverse('s3direct'), data)
self.assertEqual(response.status_code, 404)

Expand Down Expand Up @@ -239,7 +235,7 @@ def test_policy_conditions(self):
self.assertEqual(policy_dict['cache_control'], u'max-age=2592000')
self.assertEqual(policy_dict['content_disposition'], u'attachment')
self.assertEqual(policy_dict['server_side_encryption'], u'AES256')

def test_custom_region_bucket(self):
data = {
'dest': 'custom-region-bucket',
Expand All @@ -263,7 +259,8 @@ def test_optional_param_content_disposition_callable(self):
response = self.client.post(reverse('s3direct'), data)
self.assertEqual(response.status_code, 200)
policy_dict = json.loads(response.content.decode())
self.assertEqual(policy_dict['content_disposition'], 'attachment; filename="filename.jpg"')
self.assertEqual(policy_dict['content_disposition'],
'attachment; filename="filename.jpg"')

def test_optional_param_cache_control_non_callable(self):
data = {
Expand Down Expand Up @@ -389,7 +386,7 @@ def test_signing(self):
data={
'to_sign': string_to_sign,
'datetime': datetime.strftime(signing_date, '%Y%m%dT%H%M%SZ'),
'dest': 'login-not-required'
'dest': 'login-not-required'
},
enforce_csrf_checks=True,
)
Expand Down
3 changes: 2 additions & 1 deletion s3direct/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def get_upload_params(request):
file_type = request.POST['type']
file_size = int(request.POST['size'])

dest = get_s3direct_destinations().get(request.POST.get('dest', None), None)
dest = get_s3direct_destinations().get(
request.POST.get('dest', None), None)
if not dest:
resp = json.dumps({'error': 'File destination does not exist.'})
return HttpResponseNotFound(resp, content_type='application/json')
Expand Down

0 comments on commit bcfb1ac

Please sign in to comment.