bdd
This commit is contained in:
parent
fd6fe7d852
commit
7726bdc2ab
2 changed files with 29 additions and 1 deletions
27
bdd/Dockerfiles/app/app/test.py
Normal file
27
bdd/Dockerfiles/app/app/test.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
import unittest
|
||||
|
||||
class UnitTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
import app
|
||||
app = app.create_app()
|
||||
app.testing = True
|
||||
self.app = app.test_client()
|
||||
|
||||
def test_create(self):
|
||||
rv = self.app.get('/create/TEST')
|
||||
self.assertEqual(rv.status, '308 PERMANENT REDIRECT')
|
||||
self.assertEqual(rv.data,b'1')
|
||||
|
||||
def test_question(self):
|
||||
rv = self.app.get('/question/1')
|
||||
self.assertEqual(rv.status, '308 PERMANENT REDIRECT')
|
||||
self.assertEqual(rv.data,b'1')
|
||||
|
||||
def test_update(self):
|
||||
rv = self.app.get('/update/TEST/Bald/1')
|
||||
self.assertEqual(rv.status,'308 PERMANENT REDIRECT')
|
||||
self.assertEqual(rv.data,b'1')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
|
@ -1,7 +1,7 @@
|
|||
import unittest
|
||||
|
||||
class UnitTest(unittest.TestCase):
|
||||
NB_QUESTION = 9
|
||||
|
||||
def setUp(self):
|
||||
import app
|
||||
app = app.create_app()
|
||||
|
@ -13,6 +13,7 @@ class UnitTest(unittest.TestCase):
|
|||
self.assertEqual(rv.status, '200 OK')
|
||||
|
||||
def test_play(self):
|
||||
NB_QUESTION = 9
|
||||
for q in range(NB_QUESTION) :
|
||||
rv = self.app.get('/play/TEST/'+str(q))
|
||||
self.assertEqual(rv.status, '200 OK')
|
||||
|
|
Loading…
Reference in a new issue