Example #1
0
 def test_correct(self):
     self.assertTrue(CheckDateFormat.check_date_format("2016.02.01"))
Example #2
0
 def test_alphabet(self):
     self.assertFalse(CheckDateFormat.check_date_format("Hihi"))
Example #3
0
 def test_month_and_day_one_char(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014.1.2"))
Example #4
0
 def test_february_twenty_nine_true(self):
     self.assertTrue(CheckDateFormat.check_date_format("2012.02.29"))
Example #5
0
 def test_month_one_char(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014.2.03"))
Example #6
0
 def test_day_one_char(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014.02.2"))
Example #7
0
 def test_february_thirty(self):
     self.assertFalse(CheckDateFormat.check_date_format("2012.02.30"))
Example #8
0
 def test_february_twenty_nine_false(self):
     self.assertFalse(CheckDateFormat.check_date_format("2013.02.29"))
Example #9
0
 def test_april_thirtyone(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014.04.31"))
Example #10
0
 def test_september_thirtyone(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014.09.31"))
Example #11
0
 def test_too_big_day_number(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014.02.32"))
Example #12
0
 def test_too_big_month_number(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014.13.03"))
Example #13
0
 def test_too_much_number(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014.123.12"))
Example #14
0
 def test_alphanumeric(self):
     self.assertFalse(CheckDateFormat.check_date_format("2014agd"))
Example #15
0
 def switcher(input_data, get_data):
     if get_data[0] == "Donor's name":
         if Validations.check_name(input_data):
             return NameFormat.name_corr_format(input_data)
         else:
             return False
     elif get_data[0] == "Birth date":
         if CheckDateFormat.check_date_format(input_data):
             input_data = donor_dates.get_date(input_data)
             input_data = Validations.validate_birthdate(input_data)
             return input_data
         else:
             return False
     elif get_data[0] == "Weight":
         return Validations.check_weight(input_data)
     elif get_data[0] == "Gender":
         return Validations.validate_gender(input_data)
     elif get_data[0] == "Unique ID":
         if Validations.check_uniqeid_exist(input_data):
             return Validations.validate_uniqeid(input_data)
         else:
             return False
     elif get_data[0] == "Expiration of ID":
         if CheckDateFormat.check_date_format(input_data):
             input_data = donor_dates.get_date(input_data)
             input_data = Validations.exp_uniqueid(input_data)
             return input_data
         else:
             return False
     elif get_data[0] == "Blood type":
         return Validations.blood_type_validation(input_data)
     elif get_data[0] == "Hemoglobin":
         return Validations.validate_hmg_from_keypad(input_data)
     elif get_data[0] == "Last donation date":
         if "never" in input_data.lower() or input_data.lower() == "n":
             return ["Never"]
         elif CheckDateFormat.check_date_format(input_data):
             input_data = donor_dates.get_date(input_data)
             input_data = Validations.last_donation_more_than_three_month_ago(
                 input_data)
             return input_data
         else:
             return False
     elif get_data[0] == "Sickness":
         return Validations.check_arusicklastmonth(input_data)
     elif get_data[0] == "Mobile number":
         return Validations.validate_mobil_number(input_data)
     elif get_data[0] == "Email":
         return Validations.validate_email(input_data)
     elif get_data[0] == "Date of the event":
         if CheckDateFormat.check_date_format(input_data):
             input_data = donor_dates.get_date(input_data)
             if DateIsWeekday.is_date_weekday(
                     input_data
             ) and DateTenDayBeforeEvent.is_date_ten_day_before_event(
                     input_data):
                 return input_data
             else:
                 return False
         else:
             return False
     elif get_data[0] == "Start time":
         if CheckTimeFormat.check_time_form(input_data):
             return donor_dates.get_time(input_data)
         else:
             return False
     elif get_data[0] == "End time":
         if CheckTimeFormat.check_time_form(input_data):
             input_data = donor_dates.get_time(input_data)
             if EventCalculations.end_time_after_start_time(
                     input_data, get_data[2]):
                 return input_data
             else:
                 return False
         else:
             return False
     elif get_data[0] == "City":
         if Address.validate_city(input_data):
             return NameFormat.name_corr_format(input_data)
         else:
             return False
     elif get_data[0] == "Zip code":
         return Address.check_zip_code(input_data)
     elif get_data[0] == "Available beds" or get_data[
             0] == "Planned donor number":
         return CheckIfPositiveInteger.check_if_positive_integer(input_data)
     elif get_data[0] == "Address":
         if Address.validate_address(input_data):
             return NameFormat.address_name_correct_form(input_data)
         else:
             return False