Example #1
0
def test_passport_scanner_validate_passport_with_invalid_passport_without_cid_returns_none(
):
    input = 'hcl:#cfa07d eyr:2025 pid:166559648 iyr:2011 ecl:brn hgt:59in'
    ps = PassportScanner()

    result = ps.validate_passport(passport=input)
    assert result == None
Example #2
0
def test_passport_scanner_validate_passport_with_invalid_passport_returns_none(
):
    input = 'iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 hcl:#cfa07d byr:1929'
    ps = PassportScanner()

    result = ps.validate_passport(passport=input)
    assert result == None
Example #3
0
def test_passport_scanner_validate_passport_without_cid():
    input = 'hcl:#ae17e1 iyr:2013 eyr:2024 ecl:brn pid:760753108 byr:1931 hgt:179cm'
    expected_object = NorthPoleCredential(hcl='#ae17e1',
                                          iyr='2013',
                                          eyr='2024',
                                          ecl='brn',
                                          pid='760753108',
                                          byr='1931',
                                          hgt='179cm')

    ps = PassportScanner()

    result = ps.validate_passport(passport=input)
    assert result == expected_object
Example #4
0
def test_passport_scanner_validate_passport_without_newlines():
    input = 'ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm'
    expected_object = NorthPoleCredential(ecl='gry',
                                          pid='860033327',
                                          eyr='2020',
                                          hcl='#fffffd',
                                          byr='1937',
                                          iyr='2017',
                                          cid='147',
                                          hgt='183cm')

    ps = PassportScanner()

    result = ps.validate_passport(passport=input)
    assert result == expected_object
Example #5
0
def test_passport_scanner_validate_passport_with_additional_validation_returns_none(
        input):
    ps = PassportScanner()

    result = ps.validate_passport(passport=input)
    assert result == None