Skip to content

Commit ee5861f

Browse files
author
bradley griffiths
committed
Deploy on tag to PyPi
1 parent afda679 commit ee5861f

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

.travis.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
language: python
22
python:
3-
- 2.7
4-
- 3.4
5-
- 3.5
6-
- 3.6
3+
- 2.7
4+
- 3.4
5+
- 3.5
6+
- 3.6
77
env:
8-
- DJANGO=1.10
9-
- DJANGO=1.11
10-
- DJANGO=2.0
8+
- DJANGO=1.9
9+
- DJANGO=1.10
10+
- DJANGO=1.11
11+
- DJANGO=2.0
12+
matrix:
13+
exclude:
14+
- python: 2.7
15+
env: DJANGO=2.0
1116
install:
12-
- pip install -q Django~=$DJANGO.0
17+
- pip install -q Django~=$DJANGO.0
1318
script:
14-
- python runtests.py
19+
- python runtests.py
20+
deploy:
21+
provider: pypi
22+
user: bradleyg
23+
on:
24+
tags: true
25+
password:
26+
secure: a+Xq1e2yuTNtjcJ5wJ5oQxsfx/lqwYD7dbFEqdoazpkflZ8UA9AErgL2quAbo0RIRKFDBXwRNUspRtQdQ6TClKxgzsaa4AQEPWxYxx353kYMdhPjXe0/ib1rWJ0eefs/RDu0mndpQu/slNjxzV351QXPoPKo9tHgnLHWoNzYAzs=

runtests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
'django.contrib.sessions.middleware.SessionMiddleware',
2626
'django.contrib.auth.middleware.AuthenticationMiddleware',
2727
),
28+
MIDDLEWARE_CLASSES=(
29+
'django.contrib.sessions.middleware.SessionMiddleware',
30+
'django.contrib.auth.middleware.AuthenticationMiddleware',
31+
),
2832
TEMPLATES=[
2933
{
3034
'BACKEND': 'django.template.backends.django.DjangoTemplates',

s3direct/tests.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
from django.conf import settings
66
from django.contrib.auth.models import User
7-
from django.urls import resolve, reverse
87
from django.test import TestCase
98
from django.test.utils import override_settings
9+
try:
10+
from django.urls import resolve, reverse
11+
except ImportError:
12+
from django.core.urlresolvers import resolve, reverse
1013

1114
from s3direct import widgets
1215

@@ -39,13 +42,18 @@
3942
u'server_side_encryption': None,
4043
}
4144

45+
def is_authenticated(user):
46+
if callable(user.is_authenticated): # Django =< 1.9
47+
return user.is_authenticated()
48+
return user.is_authenticated
49+
4250
TEST_DESTINATIONS = {
4351
'misc': {'key': lambda original_filename: 'images/unique.jpg'},
4452
'files': {'key': '/', 'auth': lambda u: u.is_staff},
4553
'imgs': {'key': 'uploads/imgs', 'allowed': ['image/jpeg', 'image/png']},
4654
'thumbs': {'key': 'uploads/thumbs', 'allowed': ['image/jpeg'], 'content_length_range': (1000, 50000)},
47-
'vids': {'key': 'uploads/vids', 'auth': lambda u: u.is_authenticated, 'allowed': ['video/mp4']},
48-
'cached': {'key': 'uploads/vids', 'auth': lambda u: u.is_authenticated, 'allowed': '*',
55+
'vids': {'key': 'uploads/vids', 'auth': is_authenticated, 'allowed': ['video/mp4']},
56+
'cached': {'key': 'uploads/vids', 'auth': is_authenticated, 'allowed': '*',
4957
'acl': 'authenticated-read', 'bucket': 'astoragebucketname', 'cache_control': 'max-age=2592000',
5058
'content_disposition': 'attachment', 'server_side_encryption': 'AES256'},
5159
'accidental-leading-slash': {'key': '/directory/leading'},

0 commit comments

Comments
 (0)