Added basic test suite

This commit is contained in:
Oleg Lavrovsky 2017-03-13 16:59:47 +01:00
parent e6cd7c50c4
commit ea40b925f3
9 changed files with 122 additions and 0 deletions

3
requirements-test.txt Normal file
View file

@ -0,0 +1,3 @@
pytest==3.0.3
pytest-splinter==1.7.6
tox==2.3.1

0
tests/__init__.py Normal file
View file

10
tests/conftest.py Normal file
View file

@ -0,0 +1,10 @@
import pytest
@pytest.fixture
def site_url(request):
return request.config.getoption("--site-url")
def pytest_addoption(parser):
parser.addoption("--site-url", action="store", default="type1", help="url to test")

View file

View file

@ -0,0 +1,11 @@
hub:
image: selenium/hub
ports:
- "4444:4444"
firefox:
image: selenium/node-firefox
links:
- hub
expose:
- "5555"

BIN
tests/testapp/puput.db Normal file

Binary file not shown.

71
tests/testapp/settings.py Normal file
View file

@ -0,0 +1,71 @@
import os
from puput import PUPUT_APPS
WAGTAIL_SITE_NAME = 'Public Health'
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'changemepliz'
DEBUG = True
ALLOWED_HOSTS = "*"
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
INSTALLED_APPS += PUPUT_APPS
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'wagtail.wagtailcore.middleware.SiteMiddleware',
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
)
ROOT_URLCONF = 'tests.testapp.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'tests.testapp.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'tests/testapp/publichealth.db',
'USER': '',
'PASSWORD': '',
}
}
LANGUAGE_CODE = 'de-ch'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_ROOT = '/tmp/static'
STATIC_URL = '/static/'
MEDIA_ROOT = '/tmp/media'
MEDIA_URL = '/media/'

11
tests/testapp/urls.py Normal file
View file

@ -0,0 +1,11 @@
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls.static import static
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'', include('publichealth.urls')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

16
tests/testapp/wsgi.py Normal file
View file

@ -0,0 +1,16 @@
"""
WSGI config for blog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings")
application = get_wsgi_application()