def test_it_can_get_all_email_addresses_including_restricted(): profile = Profile('12345678', Name('foo'), '0000-0002-1825-0097') profile.add_email_address('*****@*****.**', restricted=True) profile.add_email_address('*****@*****.**') profile.add_email_address('*****@*****.**') assert len(profile.get_email_addresses(include_restricted=True)) == 3
def test_it_can_get_only_non_restricted_email_addresses(): profile = Profile('12345678', Name('foo'), '0000-0002-1825-0097') profile.add_email_address('*****@*****.**', restricted=True) profile.add_email_address('*****@*****.**') profile.add_email_address('*****@*****.**') assert len(profile.get_email_addresses()) == 2
def normalize_profile(profile: Profile) -> dict: data = normalize_profile_snippet(profile) data['emailAddresses'] = [ normalize(email) for email in profile.get_email_addresses() ] data['affiliations'] = [ normalize(aff) for aff in profile.get_affiliations() ] return data