def test_validate_lp_display_name(self): profile = dict(name='johnny', display_name='John Smith') utils.validate_lp_display_name(profile) self.assertEqual('John Smith', profile['display_name']) profile = dict(name='johnny', display_name='<email address hidden>') utils.validate_lp_display_name(profile) self.assertEqual('johnny', profile['display_name']) profile = None utils.validate_lp_display_name(profile) self.assertEqual(None, profile)
def _lp_profile_by_email(email): LOG.debug('Lookup user email %s at Launchpad', email) uri = LP_URI_V1 % ('people/?ws.op=getByEmail&email=' + email) lp_profile = utils.read_json_from_uri(uri, session=launchpad_session) utils.validate_lp_display_name(lp_profile) return lp_profile
def _lp_profile_by_launchpad_id(launchpad_id): LOG.debug('Lookup user id %s at Launchpad', launchpad_id) uri = LP_URI_V1 % ('~' + launchpad_id) lp_profile = utils.read_json_from_uri(uri, session=launchpad_session) utils.validate_lp_display_name(lp_profile) return lp_profile