Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
* Pending: test ADataFile
  • Loading branch information
mbourqui committed Jul 13, 2017
1 parent 57fb2a9 commit 8101a7e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ npm-debug.log*
.tox
nosetests.xml
htmlcov
# Tests media
celery_growthmonitor/tests/media/

# Translations
*.mo
Expand Down
88 changes: 20 additions & 68 deletions celery_growthmonitor/tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
from __future__ import absolute_import

import os
from distutils.version import StrictVersion

BASE_DIR = os.path.dirname(os.path.realpath(__file__))
import django

DEBUG = True
BASE_DIR = os.path.dirname(os.path.realpath(__file__))

AUTHNET_LOGIN_ID = ''
AUTHNET_TRANSACTION_KEY = ''
DEBUG = False

SECRET_KEY = 'm+qa*7_8t-=17zt_)9gi)4g%6w*v$xxkh6rwrys*bn9su+5%du'

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',

'celery_growthmonitor',

Expand All @@ -32,6 +26,7 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
},
}

Expand All @@ -41,74 +36,27 @@
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.common.CommonMiddleware',
]
MIDDLEWARE_CLASSES = MIDDLEWARE # Django < 1.10

LANGUAGE_CODE = 'en'

# MEDIA CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/stable/ref/settings/#media-root
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

# See: https://docs.djangoproject.com/en/stable/ref/settings/#media-url
MEDIA_URL = '/media/'

# STATIC FILE CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
STATIC_URL = '/static/'
if StrictVersion(django.get_version()) < StrictVersion('1.10.0'):
MIDDLEWARE_CLASSES = MIDDLEWARE

# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]

LOGIN_URL = '/accounts/login/'
TIME_ZONE = 'Europe/Zurich'

MANAGERS = []
LANGUAGE_CODE = 'en'

SITE_ID = 1

USE_I18N = True

USE_TZ = True

# TEMPLATE_DIRS = [os.path.join(os.path.dirname(__file__), 'templates')]
TEMPLATES = [
{
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
'DIRS': [
os.path.join(os.path.dirname(__file__), 'templates'),
],
'OPTIONS': {
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
'debug': DEBUG,
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
# https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
],
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
# Your stuff: custom template context processors go here
],
},
},
]
# MEDIA CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/stable/ref/settings/#media-root
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

# See: https://docs.djangoproject.com/en/stable/ref/settings/#media-url
MEDIA_URL = '/media/'

# CELERY
# ------------------------------------------------------------------------------
Expand All @@ -117,3 +65,7 @@
CELERY_ACCEPT_CONTENT = ['pickle']
CELERY_TASK_SERIALIZER = 'pickle'
CELERY_RESULT_SERIALIZER = 'pickle'

# CELERY-GROWTHMONITOR
# ------------------------------------------------------------------------------
CELERY_GROWTHMONITOR_APP_ROOT = os.path.join(MEDIA_ROOT, 'c_gm')
7 changes: 7 additions & 0 deletions celery_growthmonitor/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@


class Test(TestCase):
def tearDown(self):
from django.conf import settings
import os
import shutil
# Database is not kept but files would be otherwise
shutil.rmtree(os.path.join(settings.CELERY_GROWTHMONITOR_APP_ROOT, ))

def test_no_task(self):
test_job = TestJob()
test_job.save()
Expand Down

0 comments on commit 8101a7e

Please sign in to comment.