Skip to content

Commit

Permalink
Deploy on tag to PyPi
Browse files Browse the repository at this point in the history
  • Loading branch information
bradley griffiths committed Dec 3, 2017
1 parent afda679 commit ee5861f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
30 changes: 21 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
- 2.7
- 3.4
- 3.5
- 3.6
env:
- DJANGO=1.10
- DJANGO=1.11
- DJANGO=2.0
- DJANGO=1.9
- DJANGO=1.10
- DJANGO=1.11
- DJANGO=2.0
matrix:
exclude:
- python: 2.7
env: DJANGO=2.0
install:
- pip install -q Django~=$DJANGO.0
- pip install -q Django~=$DJANGO.0
script:
- python runtests.py
- python runtests.py
deploy:
provider: pypi
user: bradleyg
on:
tags: true
password:
secure: a+Xq1e2yuTNtjcJ5wJ5oQxsfx/lqwYD7dbFEqdoazpkflZ8UA9AErgL2quAbo0RIRKFDBXwRNUspRtQdQ6TClKxgzsaa4AQEPWxYxx353kYMdhPjXe0/ib1rWJ0eefs/RDu0mndpQu/slNjxzV351QXPoPKo9tHgnLHWoNzYAzs=
4 changes: 4 additions & 0 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
),
MIDDLEWARE_CLASSES=(
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
),
TEMPLATES=[
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
Expand Down
14 changes: 11 additions & 3 deletions s3direct/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

from django.conf import settings
from django.contrib.auth.models import User
from django.urls import resolve, reverse
from django.test import TestCase
from django.test.utils import override_settings
try:
from django.urls import resolve, reverse
except ImportError:
from django.core.urlresolvers import resolve, reverse

from s3direct import widgets

Expand Down Expand Up @@ -39,13 +42,18 @@
u'server_side_encryption': None,
}

def is_authenticated(user):
if callable(user.is_authenticated): # Django =< 1.9
return user.is_authenticated()
return user.is_authenticated

TEST_DESTINATIONS = {
'misc': {'key': lambda original_filename: 'images/unique.jpg'},
'files': {'key': '/', 'auth': lambda u: u.is_staff},
'imgs': {'key': 'uploads/imgs', 'allowed': ['image/jpeg', 'image/png']},
'thumbs': {'key': 'uploads/thumbs', 'allowed': ['image/jpeg'], 'content_length_range': (1000, 50000)},
'vids': {'key': 'uploads/vids', 'auth': lambda u: u.is_authenticated, 'allowed': ['video/mp4']},
'cached': {'key': 'uploads/vids', 'auth': lambda u: u.is_authenticated, 'allowed': '*',
'vids': {'key': 'uploads/vids', 'auth': is_authenticated, 'allowed': ['video/mp4']},
'cached': {'key': 'uploads/vids', 'auth': is_authenticated, 'allowed': '*',
'acl': 'authenticated-read', 'bucket': 'astoragebucketname', 'cache_control': 'max-age=2592000',
'content_disposition': 'attachment', 'server_side_encryption': 'AES256'},
'accidental-leading-slash': {'key': '/directory/leading'},
Expand Down

0 comments on commit ee5861f

Please sign in to comment.