Compare commits

...

9 commits

Author SHA1 Message Date
1911a4f913 tout 2022-01-11 20:24:31 +01:00
7726bdc2ab bdd 2022-01-11 15:19:00 +01:00
fd6fe7d852 main 2022-01-11 14:48:44 +01:00
be70fea80e main test 2022-01-11 14:21:02 +01:00
0c901901fc test.py update 2022-01-11 14:12:20 +01:00
e713f2e72e test.py update 2022-01-11 14:10:21 +01:00
b6bd2a595d test.py update 2022-01-11 14:06:21 +01:00
2648634b7b test.py update 2022-01-11 14:04:13 +01:00
23779029ba add test.py in main 2022-01-11 14:02:23 +01:00
6 changed files with 109 additions and 0 deletions

0
YOLO/Dockerfiles/app/app/images/TEST.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

View file

@ -0,0 +1,18 @@
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_yolo(self):
rv = self.app.get('/create/TEST/')
self.assertEqual(rv.status, '200 OK')
self.assertEqual(rv.data,b'5')
if __name__ == '__main__':
unittest.main()

View file

@ -0,0 +1,28 @@
import unittest,json
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, '200 OK')
self.assertEqual(rv.data,b'1')
def test_question(self):
rv = self.app.get('/question/1/')
self.assertEqual(rv.status, '200 OK')
self.assertEqual(rv.data,b'{"attribut": "Smiling", "intitule": "Is the person smiling?", "response": "Yes;No"}')
def test_update(self):
rv = self.app.get('/update/TEST/Smiling/1/')
self.assertEqual(rv.status,'200 OK')
n = json.loads(rv.data)['Nb']
self.assertEqual(n,19)
if __name__ == '__main__':
unittest.main()

View file

@ -0,0 +1,16 @@
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_c(self):
rv = self.app.get('/')
self.assertEqual(rv.status, '200 OK')
if __name__ == '__main__':
unittest.main()

View file

@ -0,0 +1,30 @@
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_homepage(self):
rv = self.app.get('/')
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')
def test_end(self):
rv = self.app.get('/end/TEST')
self.assertEqual(rv.status, '200 OK')
def test_lost(self):
rv = self.app.get('/lost/TEST')
self.assertEqual(rv.status,'200 OK')
if __name__ == '__main__':
unittest.main()

View file

@ -0,0 +1,17 @@
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('/update/TEST/bald/1/')
self.assertEqual(rv.status, '200 OK')
self.assertEqual(rv.data,b'12')
if __name__ == '__main__':
unittest.main()