-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_Database.py
More file actions
142 lines (110 loc) · 6.29 KB
/
Copy pathtest_Database.py
File metadata and controls
142 lines (110 loc) · 6.29 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
from unittest import TestCase
import unittest
from Database import Database
class TestDatabase(unittest.TestCase):
def test_get_by_url(self):
result = BddConnection.get_by_url(
"https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3"
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1")
self.assertTrue(result)
result = BddConnection.get_by_url(
"GTX 360")
self.assertFalse(result)
def test_start(self):
result = BddConnection.start()
self.assertTrue(result)
def test_new_categories(self):
result = BddConnection.new_categories("Bendo")
self.assertIsNone(result)
result = BddConnection.new_categories(13456)
self.assertFalse(result)
def test_select_product(self):
result = BddConnection.select_product()
self.assertTrue(result)
def test_get_cat_nom(self):
result = BddConnection.get_cat_name()
self.assertTrue(result)
def test_select_categories(self):
result = BddConnection.select_categories()
self.assertTrue(result)
def test_new_product(self):
result = BddConnection.new_product(123, "https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1", "proc",
186)
self.assertFalse(result)
result = BddConnection.new_product("nom", 123, "proc", 186)
self.assertFalse(result)
result = BddConnection.new_product("nom", "https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1", 123,
186)
self.assertFalse(result)
result = BddConnection.new_product("nom", "https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1", "proc",
"186")
self.assertFalse(result)
result = BddConnection.new_product("nom", "https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1", "proc",
186)
self.assertIsNone(result)
def test_update_product(self):
result = BddConnection.update_product("65", "nom",
"https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1", "proc", 186)
self.assertFalse(result)
result = BddConnection.update_product(65, "nom", 123, "proc", 186)
self.assertFalse(result)
result = BddConnection.update_product(65, "nom",
"https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1", 123,
186)
self.assertFalse(result)
result = BddConnection.update_product(65, "nom",
"https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1", "proc",
"186")
self.assertFalse(result)
result = BddConnection.update_product(65, "nom",
"https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1", "proc",
186)
self.assertIsNone(result)
result = BddConnection.update_product(1.5, "nom",
"https://www.amazon.fr/MSI-GeForce-RTX-3060-TI/dp/B08NW32F74/ref"
"=sr_1_1?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3 "
"%95%C3%91&dchild=1&keywords=rtx+3060&qid=1608063810&sr=8-1",
"proc",
186)
self.assertFalse(result)
def test_update_cat(self):
result = BddConnection.update_cat("65", "nom")
self.assertFalse(result)
result = BddConnection.update_cat(65, 123)
self.assertFalse(result)
result = BddConnection.update_cat(5000, 123)
self.assertFalse(result)
result = BddConnection.update_cat(65, "nom")
self.assertIsNone(result)
def test_delete_categories(self):
result = BddConnection.delete_categories("65")
self.assertFalse(result)
result = BddConnection.delete_categories(355555)
self.assertFalse(result)
result = BddConnection.delete_categories(60)
self.assertIsNone(result)
def test_delete_product(self):
result = BddConnection.delete_product("65")
self.assertFalse(result)
result = BddConnection.delete_product(355555)
self.assertFalse(result)
result = BddConnection.delete_product(60)
self.assertIsNone(result)
if __name__ == '__main__':
unittest.main()