-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testing framework, no tests written yet
- Loading branch information
Showing
6 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
source = private_storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- '2.7' | ||
- '3.6' | ||
env: | ||
- DJANGO="django>=1.8.0,<1.9.0" | ||
- DJANGO="django>=1.9.0,<1.10.0" | ||
- DJANGO="django>=1.10.0,<1.11.0" | ||
- DJANGO="django>=1.11.0,<1.12.0" | ||
before_install: | ||
- pip install codecov | ||
install: | ||
- travis_retry pip install $DJANGO django-storages boto3 -e . | ||
script: | ||
- coverage run --rcfile=.coveragerc runtests.py | ||
after_success: | ||
- codecov | ||
branches: | ||
only: | ||
- master | ||
notifications: | ||
email: | ||
recipients: | ||
- [email protected] | ||
on_success: never | ||
on_failure: always | ||
slack: | ||
secure: WWNa4MHf50AOybB+XW9UKXCk/9Q8r++Jc4xTdEib43rj4odH9wxIaTRrzAbbpo3EO2gYuLgq6mMbaIZPD5l2UmgSnyuIbeYAAKIQblT+8XMamtXwnSS5j9vfBXYdj54rTlh+jKwEMW/JiQKl+SQpfQ2v1NMvYO63m89Ev9vXvcU= | ||
on_success: never | ||
on_failure: always |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Most pathetic test case ever, only see if all files are importable. | ||
# TODO: write real tests. | ||
import private_storage | ||
import private_storage.storage.files | ||
import private_storage.storage.s3boto3 | ||
import private_storage.appconfig | ||
import private_storage.fields | ||
import private_storage.models | ||
import private_storage.permissions | ||
import private_storage.servers | ||
import private_storage.urls | ||
import private_storage.views |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env python | ||
import sys | ||
import django | ||
from django.conf import settings, global_settings as default_settings | ||
from django.core.management import execute_from_command_line | ||
from os import path | ||
|
||
if not settings.configured: | ||
module_root = path.dirname(path.realpath(__file__)) | ||
|
||
sys.path.insert(0, path.join(module_root, 'example')) | ||
|
||
if django.VERSION >= (1, 8): | ||
template_settings = dict( | ||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': (), | ||
'DEBUG': True, | ||
'OPTIONS': { | ||
'loaders': ( | ||
'django.template.loaders.filesystem.Loader', | ||
'django.template.loaders.app_directories.Loader', | ||
), | ||
'context_processors': ( | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.i18n', | ||
'django.template.context_processors.media', | ||
'django.template.context_processors.request', | ||
'django.template.context_processors.static', | ||
'django.contrib.auth.context_processors.auth', | ||
), | ||
}, | ||
}, | ||
] | ||
) | ||
else: | ||
template_settings = dict( | ||
TEMPLATE_LOADERS = ( | ||
'django.template.loaders.app_directories.Loader', | ||
'django.template.loaders.filesystem.Loader', | ||
), | ||
TEMPLATE_CONTEXT_PROCESSORS = list(default_settings.TEMPLATE_CONTEXT_PROCESSORS) + [ | ||
'django.core.context_processors.request', | ||
], | ||
TEMPLATE_DEBUG = True, | ||
) | ||
|
||
settings.configure( | ||
DEBUG = False, # will be False anyway by DjangoTestRunner. | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': ':memory:' | ||
} | ||
}, | ||
INSTALLED_APPS = ( | ||
'private_storage', | ||
), | ||
TEST_RUNNER = 'django.test.runner.DiscoverRunner', | ||
AWS_PRIVATE_STORAGE_BUCKET_NAME='foobar', | ||
**template_settings | ||
) | ||
|
||
|
||
def runtests(): | ||
argv = sys.argv[:1] + ['test', 'private_storage'] + sys.argv[1:] | ||
execute_from_command_line(argv) | ||
|
||
if __name__ == '__main__': | ||
runtests() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[tox] | ||
envlist= | ||
py27-django{18,19,110,111}, | ||
py36-django{18,19,110,111}, | ||
# py36-django-dev, | ||
coverage, | ||
|
||
[testenv] | ||
deps = | ||
django-storages | ||
boto3 | ||
django18: Django >= 1.8,<1.9 | ||
django19: Django >= 1.9,<1.10 | ||
django110: Django >= 1.10,<1.11 | ||
django111: Django >= 1.11,<1.12 | ||
django-dev: https://github.com/django/django/tarball/master | ||
commands= | ||
python runtests.py | ||
|
||
[testenv:coverage] | ||
basepython=python3.6 | ||
deps= | ||
django==1.11 | ||
coverage | ||
commands= | ||
coverage erase | ||
coverage run --rcfile=.coveragerc runtests.py | ||
coverage report |