add first tests, add .coveragerc, ignore coverage files

This commit is contained in:
Jan Dittberner 2014-05-24 13:38:08 +02:00
parent cadcc3fa68
commit 7e49bd3039
3 changed files with 35 additions and 0 deletions

2
.gitignore vendored
View file

@ -38,4 +38,6 @@ tramp
Thumbs.db
Desktop.ini
.coverage
.ropeproject/
htmlcov/

View file

@ -0,0 +1,5 @@
[run]
source = gnuviechadmin,managemails
[report]
omit = */migrations/*,*/tests/*.py,*/tests.py,gnuviechadmin/settings/local.py,gnuviechadmin/settings/production.py

View file

@ -0,0 +1,28 @@
import os
from unittest import TestCase
from django.core.exceptions import ImproperlyConfigured
from gnuviechadmin.settings.base import get_env_variable
class GetEnvVariableTest(TestCase):
def test_get_existing_env_variable(self):
os.environ['testvariable'] = 'myvalue'
self.assertEqual(get_env_variable('testvariable'), 'myvalue')
def test_get_missing_env_variable(self):
if 'missingvariable' in os.environ:
del os.environ['missingvariable']
with self.assertRaises(ImproperlyConfigured) as e:
get_env_variable('missingvariable')
self.assertEqual(
str(e.exception), 'Set the missingvariable environment variable')
class WSGITest(TestCase):
def test_wsgi_application(self):
from gnuviechadmin import wsgi
self.assertIsNotNone(wsgi.application)