Auriane Lartigue 2 years ago
parent
commit
7726bdc2ab
2 changed files with 29 additions and 1 deletions
  1. 27
    0
      bdd/Dockerfiles/app/app/test.py
  2. 2
    1
      main/Dockerfiles/app/App/app/test.py

+ 27
- 0
bdd/Dockerfiles/app/app/test.py View File

@@ -0,0 +1,27 @@
1
+import unittest
2
+
3
+class UnitTest(unittest.TestCase):
4
+
5
+	def setUp(self):
6
+		import app
7
+		app = app.create_app()
8
+		app.testing = True
9
+		self.app = app.test_client()
10
+
11
+	def test_create(self):
12
+		rv = self.app.get('/create/TEST')
13
+		self.assertEqual(rv.status, '308 PERMANENT REDIRECT')
14
+		self.assertEqual(rv.data,b'1')
15
+
16
+	def test_question(self):
17
+		rv = self.app.get('/question/1')
18
+		self.assertEqual(rv.status, '308 PERMANENT REDIRECT')
19
+		self.assertEqual(rv.data,b'1')
20
+		
21
+	def test_update(self):
22
+		rv = self.app.get('/update/TEST/Bald/1')
23
+		self.assertEqual(rv.status,'308 PERMANENT REDIRECT')
24
+		self.assertEqual(rv.data,b'1')
25
+
26
+if __name__ == '__main__':
27
+	unittest.main()

+ 2
- 1
main/Dockerfiles/app/App/app/test.py View File

@@ -1,7 +1,7 @@
1 1
 import unittest
2 2
 
3 3
 class UnitTest(unittest.TestCase):
4
-	NB_QUESTION = 9
4
+
5 5
 	def setUp(self):
6 6
 		import app
7 7
 		app = app.create_app()
@@ -13,6 +13,7 @@ class UnitTest(unittest.TestCase):
13 13
 		self.assertEqual(rv.status, '200 OK')
14 14
 
15 15
 	def test_play(self):
16
+		NB_QUESTION = 9
16 17
 		for q in range(NB_QUESTION) :
17 18
 			rv = self.app.get('/play/TEST/'+str(q))
18 19
 			self.assertEqual(rv.status, '200 OK')

Loading…
Cancel
Save