-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunittests.py
62 lines (47 loc) · 1.81 KB
/
unittests.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
52
53
54
55
56
57
58
59
60
61
62
import unittest
from main import app
import re
import pfunctions
# to run test : $ python unittests.py
#from replit you have to disable the last line in main.py that to give access to unit tests #app.run(host='0.0.0.0', port=8080)
class main(unittest.TestCase):
def test_routeCurrency(self):
adapter = app.url_map.bind('')
# This raise werkzeug.exceptions.NotFound.
adapter.match('/4/')
def test_delete_pageRoute(self):
adapter = app.url_map.bind('')
# This raise werkzeug.exceptions.NotFound.
adapter.match('/delete_page/')
def test_indexRoute(self):
adapter = app.url_map.bind('')
# This raise werkzeug.exceptions.NotFound.
adapter.match('/')
def test_creatRout(self):
adapter = app.url_map.bind('')
# This raise werkzeug.exceptions.NotFound.
adapter.match('/create/')
def test_editRoute(self):
adapter = app.url_map.bind('')
# This raise werkzeug.exceptions.NotFound.
adapter.match('/edit/')
def test_graphRoute(self):
adapter = app.url_map.bind('')
# This raise werkzeug.exceptions.NotFound.
adapter.match('/graph/')
def test_urlVariation(self):
urlVariation = pfunctions.Iconvariation(0)
match = re.findall("upx1.png", urlVariation)
self.assertEquals(match[0], "upx1.png")
def test_currencyIcon(self):
iconUrl = str(pfunctions.Geticon('bitcoin'))
match = re.findall("bitcoin.png", iconUrl)
self.assertEquals(match[0], 'bitcoin.png')
def test_currencySymbol(self):
self.assertEquals(pfunctions.Getsymbol('bitcoin'), 'BTC')
def test_price_variation(self):
self.assertEquals(pfunctions.Valuevariation(100, 110), 10)
def test_currencyName(self):
self.assertEquals(pfunctions.Getname('bitcoin'), 'Bitcoin')
if __name__ == '__main__':
unittest.main()