some documentation

This commit is contained in:
Benni Baermann 2020-11-23 17:16:03 +01:00
parent adc34e6d2d
commit bcefb026d1
2 changed files with 13 additions and 1 deletions

View file

@ -6,7 +6,10 @@ purpose: gather data from intern(WMDE) and extern(volunteers) forms to create a
ln -sr foerderbarometer/settings_development.py foerderbarometer/settings.py ln -sr foerderbarometer/settings_development.py foerderbarometer/settings.py
build database with
python3 manage.py makemigrations
run the development server with run the development server with
python3 manage.py runserver python3 manage.py runserver
@ -19,6 +22,12 @@ run the development server with
whitenoise 5.2.0 whitenoise 5.2.0
gunicorn 20.0.4 gunicorn 20.0.4
## testing
run some tests with
python3 manage.py test
## production setup ## production setup
ln -sr foerderbarometer/settings_production.py foerderbarometer/settings.py ln -sr foerderbarometer/settings_production.py foerderbarometer/settings.py

View file

@ -11,6 +11,7 @@ class TestGranted(TestCase):
settings.WHITENOISE_AUTOREFRESH = True settings.WHITENOISE_AUTOREFRESH = True
def test_set_granted(self): def test_set_granted(self):
'''test if the model function set_granted() works as intended'''
obj = HonoraryCertificate.objects.create(realname='hurzel',email='hurzel@web.de') obj = HonoraryCertificate.objects.create(realname='hurzel',email='hurzel@web.de')
self.assertEqual(obj.granted,None) self.assertEqual(obj.granted,None)
HonoraryCertificate.set_granted(obj.pk, True) HonoraryCertificate.set_granted(obj.pk, True)
@ -18,10 +19,12 @@ class TestGranted(TestCase):
self.assertEqual(obj2.granted,True) self.assertEqual(obj2.granted,True)
def test_source_link(self): def test_source_link(self):
'''test if link to source code is included in main page'''
response = self.client.get('', follow=True) response = self.client.get('', follow=True)
#print (response.content) #print (response.content)
self.assertContains(response,'<a href="https://srcsrv.wikimedia.de/beba/foerderbarometer">Sourcecode</a>') self.assertContains(response,'<a href="https://srcsrv.wikimedia.de/beba/foerderbarometer">Sourcecode</a>')
def test_access_denied(self): def test_access_denied(self):
'''test if /intern redirects to login page if not logged in'''
response = self.client.get('/intern', follow=True) response = self.client.get('/intern', follow=True)
self.assertContains(response,'password') self.assertContains(response,'password')