add first tests, add .coveragerc, ignore coverage files
This commit is contained in:
parent
cadcc3fa68
commit
7e49bd3039
3 changed files with 35 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -38,4 +38,6 @@ tramp
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
Desktop.ini
|
Desktop.ini
|
||||||
|
|
||||||
|
.coverage
|
||||||
.ropeproject/
|
.ropeproject/
|
||||||
|
htmlcov/
|
||||||
|
|
5
gnuviechadmin/.coveragerc
Normal file
5
gnuviechadmin/.coveragerc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[run]
|
||||||
|
source = gnuviechadmin,managemails
|
||||||
|
|
||||||
|
[report]
|
||||||
|
omit = */migrations/*,*/tests/*.py,*/tests.py,gnuviechadmin/settings/local.py,gnuviechadmin/settings/production.py
|
28
gnuviechadmin/gnuviechadmin/tests.py
Normal file
28
gnuviechadmin/gnuviechadmin/tests.py
Normal 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)
|
Loading…
Reference in a new issue