コード例 #1
0
def test_expect_none_when_no_age_over_verification_exists():
    attribute_list = create_single_attribute_list(
        name=config.ATTRIBUTE_GIVEN_NAMES,
        value="Jenny",
        anchors=None,
        content_type=Protobuf.CT_STRING,
    )

    human_profile = Profile(attribute_list)

    age_over_verification = human_profile.find_age_over_verification(18)
    assert age_over_verification is None
コード例 #2
0
def test_get_age_over_verification(attribute_value, expected_age_over,
                                   expected_value):
    attribute_list = create_single_attribute_list(
        name=config.ATTRIBUTE_AGE_OVER + str(expected_age_over),
        value=attribute_value.encode(),
        anchors=None,
        content_type=Protobuf.CT_STRING,
    )

    human_profile = Profile(attribute_list)
    print(human_profile.attributes)

    age_verifications = human_profile.get_age_verifications()
    age_verification = human_profile.find_age_over_verification(
        expected_age_over)

    assert len(age_verifications) == 1
    assert isinstance(age_verification, AgeVerification)
    assert age_verification.result is expected_value