def test_setname11(): new_user = create_user() setname(new_user['u_id'], 's', 'Smith') new_user_dictionary = { #Dictionary with new information "user": { "u_id": new_user['u_id'], "email": '*****@*****.**', "name_first": "s", "name_last": "Smith", "handle_str": "JohnSmith" } } assert profile(new_user['token'],new_user['u_id']) == new_user_dictionary
def test_setname03(): new_user = create_user() #changes and last name to Slopsmcgee setname(new_user['u_id'],"John","Slopsmcgee") new_user_dictionary = { #Dictionary with new information "user": { "u_id": new_user['u_id'], "email": '*****@*****.**', "name_first": "John", "name_last": "Slopsmcgee", "handle_str": "JohnSmith" } } #assert they are the same assert profile(new_user['token'],new_user['u_id']) == new_user_dictionary
def test_setname02(): new_user = create_user() #changes first name to Citizen setname(new_user['u_id'],"Citizen","Smith") new_user_dictionary = { #Dictionary with updated first name "user": { "u_id": new_user['u_id'], "email": '*****@*****.**', "name_first": "Citizen", "name_last": "Smith", "handle_str": "JohnSmith" } } #assert they are the same assert profile(new_user['token'],new_user['u_id']) == new_user_dictionary
def test_setname12(): new_user = create_user() with pytest.raises(InputError): setname(000000000000, 'Steven', 's' * 5)
def test_setname07(): new_user = create_user() with pytest.raises(InputError): setname(new_user['u_id'], 'Steven', 's' * 0)
def test_setname06(): new_user = create_user() with pytest.raises(InputError): setname(new_user['u_id'], 'b' * 0, "Slopsmcgee")
def user_setname(): data = request.get_json() return dumps( user.setname(data["token"], data["name_first"], data["name_last"]))