-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_frontend.py
51 lines (38 loc) · 1.49 KB
/
test_frontend.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import unittest
import requests
class TestFlask(unittest.TestCase):
def test_web_app_running(self):
try:
r = requests.get("http://127.0.0.1:5000/")
except:
self.fail("Could not open the web app, testing failed")
def test_web_title(self):
r = requests.get("http://127.0.0.1:5000/")
page_src = r.text
if page_src.find("OLIBAKA") < 0:
self.fail("Can't find title of web")
def test_cart_running(self):
try:
r = requests.get("http://127.0.0.1:5000/cart.html/")
except:
self.fail("Could not open the cart page, testing failed")
def test_cart_lang(self):
r = requests.get("http://127.0.0.1:5000/cart.html")
page_src = r.text
if page_src.find("item") < 0:
self.fail("Can't find item in web")
if page_src.find("Cart") < 0:
self.fail("Can't find cart in web")
if page_src.find("Summary") < 0:
self.fail("Can't find summary in web")
if page_src.find("SHIPPING") < 0:
self.fail("Can't find shipping in web")
def test_web_footer(self):
r = requests.get("http://127.0.0.1:5000/")
page_src = r.text
if page_src.find("oliphant0803") < 0:
self.fail("Can't find oliver in web")
if page_src.find("kaka0905") < 0:
self.fail("Can't find katherine in web")
if __name__ == "__main__":
unittest.main(warnings='ignore', failfast = True)