Add initial tests for Web Interface.

This commit is contained in:
cookietime--yay 2019-03-04 18:49:12 +01:00
parent fa3dda1c60
commit 050e641bb0
3 changed files with 103 additions and 0 deletions

View file

@ -0,0 +1,26 @@
from webtest import TestApp
import unittest
from ticketfrei import frontend
class TestLogin(unittest.TestCase):
def test_login_not_registered(self):
app = TestApp(frontend.application)
request = app.post('/login', {'email': 'foo@abc.de', 'pass': 'bar'}, expect_errors=True)
self.assertEqual(request.status_code, 401)
class TestRegister(unittest.TestCase):
def test_register(self):
app = TestApp(frontend.application)
request = app.post('/register', {'email': 'foo@abc.de', 'pass': 'bar', 'pass-repeat': 'bar', 'city': 'testcity'}, expect_errors=True)
self.assertEqual(request.status_code, 201)
def test_getRoot(self):
app = TestApp(frontend.application)
request = app.get('/')
self.assertEqual(request.status_code, 200)
if __name__ == '__main__':
unittest.main()

BIN
tests/db.sqlite Normal file

Binary file not shown.

77
tests/errors.log Normal file
View file

@ -0,0 +1,77 @@
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'
Could not send confirmation mail to foo@abc.de
Traceback (most recent call last):
File "/home/kaese/Projekte/ticketfrei/ticketfrei/frontend.py", line 42, in register_post
link = url('confirm/' + city + '/%s' % db.user_token(email, password))
File "/home/kaese/Projekte/ticketfrei/ticketfrei/db.py", line 186, in user_token
return jwt.encode({
AttributeError: module 'jwt' has no attribute 'encode'