def test_valid_visa_format(): """ Tests visa format validation is being done properly """ assert valid_visa_format("JMZ0S-89IA9-OTCLY-MQILJ-P7CTY") is True assert valid_visa_format("JMZ-89I-OTC-MQI-P7C") is False assert valid_visa_format("") is False assert valid_visa_format("jmz0s-89ia9-otcly-moilj-p7cty") is True
def test_correct_visa_format(): """ Test to see if the visa is accepted """ assert valid_visa_format("CFR6X-XSMVA") == True try: assert valid_visa_format(99999 - 9999) except TypeError: return True
def test_valid_visa_format(): """ Test to see if the visa is accepted """ assert valid_visa_format("CKC6X-XSMVA") == True try: assert valid_visa_format(99999 - 9999) except TypeError: return True try: assert valid_visa_format("nopee-nopee") except AssertionError: return True
def valid_file_contents(file_contents): """ This function checks to see that the file contents are valid: no required fields are missing, location information is complete, birth_date and passport/visa number is valid. :param file_contents: a list of dictionaries denoting returning citizens :return: True if the file contents are valid, False otherwise """ valid_file = True for person in file_contents: for item in REQUIRED_FIELDS: if item not in person: valid_file = False for item in person: if item in LOCATION_FIELDS: if not valid_location_field(person[item]): valid_file = False elif item is "passport": if not valid_passport_format(person[item]): valid_file = False elif item is "visa": if not valid_date_format(person["visa"]["date"]): valid_file = False if not valid_visa_format(person["visa"]["code"]): valid_file = False elif item is "entry_reason": if person[item] not in REASON_FOR_ENTRY: valid_file = False elif item is "birth_date": if not valid_date_format(person[item]): valid_file = False if unknown_location_exists(person, COUNTRIES): valid_file = False return valid_file
def test_valid_visa_format(): """ Tests the valid_visa_format function. A valid visa format should be two groups of five alphanumeric characters separated by a dash. """ assert valid_visa_format("52NDX-2RSEF") is True assert valid_visa_format("2nrx3-fkWW3") is True assert valid_visa_format("2nrx3-fkWW32") is False assert valid_visa_format("2nr_3-fkWW2") is False assert valid_visa_format("2nrx3-fkWW2-WJD23") is False assert valid_visa_format("2nrx3-fkWW") is False assert valid_visa_format("2rjxefn2rx") is False
def test_valid_visa_format(): """ Visa is valid. """ assert valid_visa_format("12A34-56B78") is True assert valid_visa_format("A1234-Z9876") is True assert valid_visa_format("12AA34-56BB78") is False assert valid_visa_format("123456-789011") is False assert valid_visa_format("12A3456BB78") is False assert valid_visa_format("#2A34-56B78") is False assert valid_visa_format("12T4512X45") is False
def test_valid_visa_format(): assert valid_visa_format("i8fue-si4kf") == True
def test_invalid_visa_format_2(): """ Testing invalid visa format due to the inclusion of symbols rather than numbers or letters """ assert valid_visa_format("&&&&&-si4kf") == False
def test_invalid_visa_format_1(): """ Testing invalid visa format due to missing characters """ assert valid_visa_format("ifue-si4kf") == False