예제 #1
0
 def test_name_correct(self):
     self.assertTrue(Validations.check_name(" Abraham  Lincoln "))
예제 #2
0
 def test_name_incorrect(self):
     self.assertFalse(Validations.check_name("123"))
예제 #3
0
 def test_last_donation_today_is_may29(self):
     last_donation_date = datetime.strptime("2015.02.28", "%Y.%m.%d").date()
     today_may29 = datetime.strptime("2015.05.29", "%Y.%m.%d").date()
     self.assertTrue(
         Validations.last_donation_more_than_three_month_ago(
             [last_donation_date, today_may29]))
예제 #4
0
 def test_blood_type_false2(self):
     self.assertFalse(Validations.blood_type_validation("A"))
예제 #5
0
 def test_last_donation_within_threemonth(self):
     eighty_eight_days_ago = datetime.now().date() - timedelta(days=88)
     with self.assertRaises(SystemExit):
         Validations.last_donation_more_than_three_month_ago(
             eighty_eight_days_ago)
예제 #6
0
 def test_uniqueid_id(self):
     self.assertEqual(["Identity card", "123456AB"],
                      Validations.validate_uniqeid("123456AB"))
예제 #7
0
 def test_exp_uniqueid_old(self):
     yesterday = datetime.now().date() - timedelta(days=1)
     with self.assertRaises(SystemExit):
         Validations.exp_uniqueid(yesterday)
예제 #8
0
 def test_birthdate3(self):
     test_date = datetime.now().date().replace(
         year=datetime.now().date().year - 18)
     test_date += timedelta(days=1)
     with self.assertRaises(SystemExit):
         Validations.validate_birthdate(test_date)
예제 #9
0
 def test_age_of_donor_one_day_to_eightteen(self):
     test_date = datetime.now().date().replace(
         year=datetime.now().date().year - 18)
     test_date += timedelta(days=1)
     self.assertEqual(17, Validations.count_age_of_donor(test_date))
예제 #10
0
 def test_birthdate(self):
     test_date = datetime.strptime("1997.11.09", "%Y.%m.%d").date()
     self.assertTrue(Validations.validate_birthdate(test_date))
예제 #11
0
 def test_birthdate2(self):
     test_date = datetime.now().date().replace(
         year=datetime.now().date().year - 18)
     self.assertTrue(Validations.validate_birthdate(test_date))
예제 #12
0
 def test_email_correctcom(self):
     self.assertTrue(Validations.validate_email("*****@*****.**"))
예제 #13
0
 def test_email_correcthu(self):
     self.assertTrue(Validations.validate_email("*****@*****.**"))
예제 #14
0
 def test_email_not_enough_charcom(self):
     self.assertFalse(Validations.validate_email("[email protected]"))
예제 #15
0
 def test_gender_female_short(self):
     self.assertEqual("Female", Validations.validate_gender("f"))
예제 #16
0
 def test_weight_alpha(self):
     self.assertFalse(Validations.check_weight("Fifty kilo"))
예제 #17
0
 def test_uniqueid_incorrect(self):
     self.assertFalse(Validations.validate_uniqeid("never"))
예제 #18
0
 def test_age_of_donor_just_eightteen(self):
     test_date = datetime.now().date().replace(
         year=datetime.now().date().year - 18)
     self.assertEqual(18, Validations.count_age_of_donor(test_date))
예제 #19
0
 def test_uniqueid_passport(self):
     self.assertEqual(["Passport", "ABCDEF12"],
                      Validations.validate_uniqeid("ABCDEF12"))
예제 #20
0
 def test_weight_fourtynine(self):
     with self.assertRaises(SystemExit):
         Validations.check_weight("49")
예제 #21
0
 def test_exp_uniqueid_valid(self):
     today = datetime.now().date()
     self.assertTrue(Validations.exp_uniqueid(today))
예제 #22
0
 def test_weight_fifty(self):
     self.assertTrue(Validations.check_weight("50"))
예제 #23
0
 def test_blood_type_true(self):
     self.assertEqual("A+", Validations.blood_type_validation("a+"))
예제 #24
0
 def test_gender_incorrect(self):
     self.assertFalse(Validations.validate_gender("g"))
예제 #25
0
 def test_last_donation_out_of_threemonth(self):
     ninetyfive_days_ago = datetime.now().date() - timedelta(days=95)
     self.assertTrue(
         Validations.last_donation_more_than_three_month_ago(
             ninetyfive_days_ago))
예제 #26
0
 def test_gender_number(self):
     self.assertFalse(Validations.validate_gender("12"))
예제 #27
0
 def test_last_donation_today_is_dec31(self):
     last_donation_date = datetime.strptime("2015.09.30", "%Y.%m.%d").date()
     today_dec31 = datetime.strptime("2015.12.31", "%Y.%m.%d").date()
     self.assertTrue(
         Validations.last_donation_more_than_three_month_ago(
             [last_donation_date, today_dec31]))
예제 #28
0
 def test_gender_male_short(self):
     self.assertEqual("Male", Validations.validate_gender("m"))
예제 #29
0
 def test_last_donation_today_is_may31_exit(self):
     ninetyfive_days_ago = datetime.now().date() - timedelta(days=95)
     today_may31 = datetime.strptime("2015.05.31", "%Y.%m.%d").date()
     with self.assertRaises(SystemExit):
         Validations.last_donation_more_than_three_month_ago(
             [ninetyfive_days_ago, today_may31])
예제 #30
0
 def test_email_incorrect(self):
     self.assertFalse(Validations.validate_email("sadf"))