Example #1
0
def get_ideas(user_name):
    user_list = [user_name]
    user_list += db.get_following(user_name)
    idea_list = []
    for user in user_list:
        idea_list.append(db.get_most_recent_idea(user))
    return idea_list
Example #2
0
            def correct_response():
                # Checks that the data has been updated in the users table
                user_data1 = main.get_user_data("new_user_name")
                user_data2 = main.get_user_data("new_e_mail")
                scen_1 = user_data1["user_name"] == user_data2["user_name"] == "new_user_name"
                scen_2 = user_data1["e_mail"] == user_data2["e_mail"] == "new_e_mail"
                scen_3 = user_data1["country"] == user_data2["country"] == "new_country"
                scen_4 = user_data1["city"] == user_data2["city"] == "new_city"
                scen_5 = user_data1["location"] == user_data2["location"] == "new_location"
                scen_6 = user_data1["avatar_image"] == user_data2["avatar_image"] == "new_image"
                scen_7 = response["response"] == "Success"
                users_updated = scen_1 and scen_2 and scen_3 and scen_4 and scen_5 and scen_6 and scen_7

                # Checks that the data has been updated in the ideas table
                # Since an idea by the user who's user name has been updated
                # had posted an idea, the function get_most_recent_idea returns
                # a non-empty list when using the new user name as parameter
                ideas_updated = db.get_most_recent_idea("new_user_name") != []

                # Checks that the data has been updated in the messages table
                # Since the original user has sent a message, the return value
                # from get conversation using the new user name and the other
                # user's name has to return a non-empty list
                messages_updated = db.get_conversation("new_user_name", "TestUser2") != []

                # Checks that the data has been updated in the comments table
                # The user who's name was changed posted a comment on the idea with id 2
                comments_updated = False
                for comment in db.get_comments(2):
                    if "new_user_name" in comment:
                        comments_updated = True

                return users_updated and ideas_updated and messages_updated and comments_updated
Example #3
0
def get_ideas(user_name):
    user_list = [user_name]
    user_list += db.get_following(user_name)
    idea_list = []
    for user in user_list:
        idea_list.append(db.get_most_recent_idea(user))
    return idea_list