Add more test stubs for frontend.

This commit is contained in:
cookietime--yay 2019-03-04 22:46:42 +01:00
parent eabc43cdba
commit f5f741a5c2
3 changed files with 46 additions and 13 deletions

View file

@ -0,0 +1,20 @@
[twitter]
# You get those keys when you follow these steps:
# https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens
consumer_key = "your_consumer_key"
consumer_secret = "your_consumer_secret"
[web]
host = "0.0.0.0" # will be used by bottle as a host.
port = 80
contact = "b3yond@riseup.net"
[mail]
mbox_user = "root"
[database]
db_path = "/var/ticketfrei/db.sqlite"
[log]
log_frontend = "/var/ticketfrei/frontend.log"
log_backend = "/var/log/ticketfrei/backend.log"

View file

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

View file

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