예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
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
예제 #4
0
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