diff --git a/tests/WebApplicationTest.py b/tests/WebApplicationTest.py new file mode 100644 index 0000000..cc48076 --- /dev/null +++ b/tests/WebApplicationTest.py @@ -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() diff --git a/tests/db.sqlite b/tests/db.sqlite new file mode 100644 index 0000000..8e9d3f2 Binary files /dev/null and b/tests/db.sqlite differ diff --git a/tests/errors.log b/tests/errors.log new file mode 100644 index 0000000..5239b00 --- /dev/null +++ b/tests/errors.log @@ -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'