This commit is contained in:
Auriane Lartigue 2022-01-11 20:24:31 +01:00
parent 7726bdc2ab
commit 1911a4f913
5 changed files with 62 additions and 10 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

@ -1,4 +1,4 @@
import unittest
import unittest,json
class UnitTest(unittest.TestCase):
@ -9,19 +9,20 @@ class UnitTest(unittest.TestCase):
self.app = app.test_client()
def test_create(self):
rv = self.app.get('/create/TEST')
self.assertEqual(rv.status, '308 PERMANENT REDIRECT')
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, '308 PERMANENT REDIRECT')
self.assertEqual(rv.data,b'1')
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/Bald/1')
self.assertEqual(rv.status,'308 PERMANENT REDIRECT')
self.assertEqual(rv.data,b'1')
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,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()