def test_utils_extract_user_name(): profile = {'firstName':'Madonna'} assert utils.extract_user_name(profile) == 'Madonna' profile = {'firstName':'Oscar', 'lastName':'the Grouch'} assert utils.extract_user_name(profile) == 'Oscar the Grouch' profile['displayName'] = None assert utils.extract_user_name(profile) == 'Oscar the Grouch' profile['displayName'] = '' assert utils.extract_user_name(profile) == 'Oscar the Grouch' profile['displayName'] = 'Assistant Professor Oscar the Grouch, PhD' assert utils.extract_user_name(profile) == 'Assistant Professor Oscar the Grouch, PhD' profile['userName'] = '******' assert utils.extract_user_name(profile) == 'otg'
def test_utils_extract_user_name(): profile = {"firstName": "Madonna"} assert utils.extract_user_name(profile) == "Madonna" profile = {"firstName": "Oscar", "lastName": "the Grouch"} assert utils.extract_user_name(profile) == "Oscar the Grouch" profile["displayName"] = None assert utils.extract_user_name(profile) == "Oscar the Grouch" profile["displayName"] = "" assert utils.extract_user_name(profile) == "Oscar the Grouch" profile["displayName"] = "Assistant Professor Oscar the Grouch, PhD" assert utils.extract_user_name(profile) == "Assistant Professor Oscar the Grouch, PhD" profile["userName"] = "******" assert utils.extract_user_name(profile) == "otg"