forked from ivbhatt/Simplii
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.py
33 lines (26 loc) · 1.22 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import unittest
from app import app
from app import add_new_task
import requests
class TestModule(unittest.TestCase):
def test_home(self):
tester = app.test_client(self)
response = tester.get("/", content_type='html/text')
self.assertEqual(response.status_code, 200)
def test_add_task(self):
tester = app.test_client(self)
inp = {"taskName":"dummy_task","deadline":"2021-03-30T21:08","estimateInput":1,"taskType":"physical",'quant/verbal':"NA","contentconsump":"NA","difficulty":"3"}
response = requests.post("http://127.0.0.1:5000/add_task", data=inp)
self.assertEqual(response.status_code, 200)
def test_delete_task(self):
tester = app.test_client(self)
inp = {"id" : "23"}
response = requests.post("http://127.0.0.1:5000/delete_task", data=inp)
self.assertEqual(response.status_code, 200)
def test_update_user_info(self):
tester = app.test_client(self)
inp = {"name" : "user1", "email":"[email protected]","emailChoose":"[email protected]"}
response = requests.post("http://127.0.0.1:5000/update_user_info", data=inp)
self.assertEqual(response.status_code, 200)
if __name__ == "__main__":
unittest.main()