-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdonation_location_unit_test.py
More file actions
188 lines (147 loc) · 6.53 KB
/
donation_location_unit_test.py
File metadata and controls
188 lines (147 loc) · 6.53 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import unittest
from donation_location import Donation_class
class DonationLocation(unittest.TestCase):
global test
test=Donation_class("","","","","","","","","","")
############
##zip_code##
############
def test_zip_code_one(self):
test.zip_code = "3530"
self.assertTrue(test.check_zip_code() and test.validate_zip_code())
def test_zip_code_two(self):
test.zip_code="35302"
self.assertFalse(test.check_zip_code() and test.validate_zip_code())
def test_zip_code_three(self):
test.zip_code="353"
self.assertFalse(test.check_zip_code() and test.validate_zip_code())
def test_zip_code_four(self):
test.zip_code="353e"
self.assertFalse(test.check_zip_code() and test.validate_zip_code())
def test_zip_code_five(self):
test.zip_code="353 "
self.assertFalse(test.check_zip_code() and test.validate_zip_code())
############
## city ##
############
def test_city_one(self):
test.city = "miskolc"
self.assertTrue(test.validate_city())
def test_city_two(self):
test.city = "debrecen"
self.assertFalse(test.validate_city())
def test_city_three(self):
test.city = "kolc"
self.assertFalse(test.validate_city())
def test_city_four(self):
test.city = "MISKOLC"
self.assertTrue(test.validate_city())
def test_city_five(self):
test.city = "Mis kolc"
self.assertFalse(test.validate_city())
def test_city_six(self):
test.city = " Miskolc"
self.assertFalse(test.validate_city())
def test_city_seven(self):
test.city = "SzErEnCs"
self.assertTrue(test.validate_city())
#############
## Address ##
#############
def test_address_one(self):
test.address = "Miskolc 12312312"
self.assertTrue(test.validate_address())
def test_address_two(self):
test.address = "123145756463551231457564635512314575646355"
self.assertTrue(test.validate_address())
def test_address_three(self):
test.address = " "*50
self.assertTrue(test.validate_address())
def test_address_four(self):
test.address = "a"*50
self.assertTrue(test.validate_address())
###################################
## number of successful donation ##
###################################
def test_number_of_successful_donation_one(self):
test.number_of_successful_donation = "100"
test.max_donor_number = "50"
self.assertTrue(test.check_number_of_successful_donation() and test.valid_number_of_successful_donation())
def test_number_of_successful_donation_two(self):
test.number_of_successful_donation = "asd"
test.max_donor_number = "50"
self.assertFalse(test.check_number_of_successful_donation() and test.valid_number_of_successful_donation())
def test_number_of_successful_donation_three(self):
test.number_of_successful_donation = "asd"
test.max_donor_number = "lol"
self.assertFalse(test.check_number_of_successful_donation() and test.valid_number_of_successful_donation())
def test_number_of_successful_donation_four(self):
test.number_of_successful_donation = "1000"
test.max_donor_number = "feri"
self.assertFalse(test.check_number_of_successful_donation() and test.valid_number_of_successful_donation())
def test_number_of_successful_donation_five(self):
test.number_of_successful_donation = "10"
test.max_donor_number = "-2"
self.assertFalse(test.check_number_of_successful_donation() and test.valid_number_of_successful_donation())
def test_number_of_successful_donation_six(self):
test.number_of_successful_donation = "-5"
test.max_donor_number = "2"
self.assertFalse(test.check_number_of_successful_donation() and test.valid_number_of_successful_donation())
def test_number_of_successful_donation_seven(self):
test.number_of_successful_donation = "-5"
test.max_donor_number = "-2"
self.assertFalse(test.check_number_of_successful_donation() and test.valid_number_of_successful_donation())
def test_number_of_successful_donation_eight(self):
test.number_of_successful_donation = " "
test.max_donor_number = " "
self.assertFalse(test.check_number_of_successful_donation() and test.valid_number_of_successful_donation())
####################
## available_beds ##
####################
def test_available_beds_one(self):
test.available_beds = "50"
self.assertTrue(test.check_available_beds())
def test_available_beds_two(self):
test.available_beds = "0"
self.assertTrue(test.check_available_beds())
def test_available_beds_three(self):
test.available_beds = "-1"
self.assertFalse(test.check_available_beds())
def test_available_beds_four(self):
test.available_beds = " "
self.assertFalse(test.check_available_beds())
def test_available_beds_five(self):
test.available_beds = "asd"
self.assertFalse(test.check_available_beds())
##########################
## planned_donor_number ##
##########################
def test_planned_donor_number_one(self):
test.planned_donor_number = "50"
self.assertTrue(test.check_planned_donor_number())
def test_planned_donor_number_two(self):
test.planned_donor_number = "-50"
self.assertFalse(test.check_planned_donor_number())
def test_planned_donor_number_three(self):
test.planned_donor_number = ""
self.assertFalse(test.check_planned_donor_number())
def test_planned_donor_number_four(self):
test.planned_donor_number = "asdfgh"
self.assertFalse(test.check_planned_donor_number())
def test_planned_donor_number_five(self):
test.planned_donor_number = " "
self.assertFalse(test.check_planned_donor_number())
############################
## date_and_time_of_event ##
############################
def test_date_and_time_of_event_one(self):
test.date_and_time_of_event = "2015.12.11"
self.assertTrue(test.validate_date_and_time_of_event())
def test_date_and_time_of_event_two(self):
test.date_and_time_of_event = "2015.12.12"
self.assertFalse(test.validate_date_and_time_of_event())
def test_date_and_time_of_event_three(self):
test.date_and_time_of_event = "2015.06.01"
self.assertFalse(test.validate_date_and_time_of_event())
if __name__ == '__main__':
unittest.main()