Skip to content

Commit

Permalink
EGCETSII#43-fix: re-add test settings
Browse files Browse the repository at this point in the history
  • Loading branch information
JSnow11 committed Jan 9, 2022
1 parent 5a5ce29 commit 3b6956a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
run: |
cd decide
coverage run --branch --source=./administration/ ./manage.py test administration --noinput -v 2
coverage run --branch --source=./administration/ ./manage.py test --settings=decide.test_settings administration --noinput -v 2
coverage xml
- name: Codacy Coverage Reporter
uses: codacy/[email protected]
Expand Down
88 changes: 31 additions & 57 deletions decide/decide/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
"""
Django settings for decide project.
Generated by 'django-admin startproject' using Django 2.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os
import django_heroku

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

Expand All @@ -24,11 +12,9 @@

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["*"]

# Login redirect
LOGIN_URL = '/authentication/login_form/'
LOGIN_REDIRECT_URL = '/authentication/bienvenida/'

# Application definition

Expand Down Expand Up @@ -60,7 +46,6 @@
'base.backends.AuthBackend',
]


MODULES = [
'administration',
'authentication',
Expand All @@ -72,36 +57,39 @@
'postproc',
'store',
'visualizer',
'backups',
]

ENV_DEVELOP = os.environ.get('ENV_DEVELOP', False)
ENV_MAIN = os.environ.get('ENV_MAIN', False)

if ENV_DEVELOP:
BASEURL = 'https://decide-full-tortuga-admin-dev.herokuapp.com'
elif ENV_MAIN:
BASEURL = 'https://decide-full-tortuga-admin.herokuapp.com'
else:
BASEURL = 'http://localhost:8000'

APIS = {
'administration': BASEURL,
'authentication': BASEURL,
'base': BASEURL,
'booth': BASEURL,
'census': BASEURL,
'mixnet': BASEURL,
'postproc': BASEURL,
'store': BASEURL,
'visualizer': BASEURL,
'voting': BASEURL,
'authentication': 'http://localhost:8000',
'base': 'http://localhost:8000',
'booth': 'http://localhost:8000',
'census': 'http://localhost:8000',
'mixnet': 'http://localhost:8000',
'postproc': 'http://localhost:8000',
'store': 'http://localhost:8000',
'visualizer': 'http://localhost:8000',
'voting': 'http://localhost:8000',
}

BASEURL = 'http://localhost:8000'

DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'decide',
'CLIENT': {
'host': '127.0.0.1',
}

}
}

MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware', # added to solve CORS
'django.middleware.common.CommonMiddleware', # added to solve CORS
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
Expand All @@ -127,25 +115,8 @@
},
]

STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'administration', 'frontend', 'build', 'static'),
)

WSGI_APPLICATION = 'decide.wsgi.application'

# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'decide',
'CLIENT': {
'host': '127.0.0.1',
}
}
}

# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
Expand All @@ -165,6 +136,7 @@
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/

Expand All @@ -178,6 +150,7 @@

USE_TZ = True


TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

# Static files (CSS, JavaScript, Images)
Expand All @@ -201,10 +174,11 @@
if os.path.exists("config.jsonnet"):
import json
from _jsonnet import evaluate_file

config = json.loads(evaluate_file("config.jsonnet"))
for k, v in config.items():
vars()[k] = v


INSTALLED_APPS = INSTALLED_APPS + MODULES
django_heroku.settings(locals())

PANEL_URI = "http://localhost:3000"

0 comments on commit 3b6956a

Please sign in to comment.