TASK: You have been hired to help manage the data for an up and coming fitness tracker app: Python Pulse. The app allows users to create profiles, track their workouts, set goals, and monitor their progress. The tables in the database are represented by the ER diagram below.
The tables have the following relationships:
- A user has one and only one profile.
- A user can create many goals. Each goal has one and only one user.
- A user can have multiple workouts and workouts can have multiple users.
This assignment can grade itself! To setup the autograding, you should do the following:
- Clone this file to your local machine using the command
git clone PASTE_URL_HERE- Open the downloaded file in your VS Code editor.
- In the left hand sidebar, press the "Testing" menu represented by the picture of a flask.
- Click "Configure Python Tests".
- You'll have two options to select. Select pytest.
- Select the folder where the tests live. You can simply select
. Root directory. - You can now run the tests by pressing the play icon. A passing test will get a ✅ and a failing test will get a ❌.
- Run the tests as you code and by the end it should be all ✅ if you have followed the specifications for this assignment!
test_users_table_exists: Tests that theuserstable exists in yourpython_pulse.db.test_users_table_columns: Tests that theuserstable has the correct columns (user_id,username,password, andemail) and data types for each of these columns.test_profiles_table_exists: Tests that theprofilestable exists in yourpython_pulse.db.test_profiles_table_columns: Tests that theprofilestable has the correct columns (profile_id,user_id,height,weight,age, andnotes) and data types for each of these columns.test_users_data: Tests that the sample user data has been inserted into theuserstable.test_profiles_data: Tests that the sample profile data has been inserted into theprofilestable.test_goals_table_exists: Tests that thegoalstable exists in yourpython_pulse.db.test_goals_table_columns: Tests that thegoalstable has the correct columns (goal_id,name,target_value, anduser_id) and data types for each of these columns.test_goals_data: Tests that the sample goal data has been inserted into thegoalstable.test_workouts_table_exists: Tests that theworkoutstable exists in yourpython_pulse.db.test_user_workout_table_exists: Tests that theuser_workouttable exists in yourpython_pulse.db.test_workouts_table_columns: Tests that the workouts table has the correct columns (workout_id,name,description, andduration) and data types for each of these columns.test_user_workout_table_columns: Tests that theuser_workouttable has the correct columns (user_idandworkout_id) and data types for each of these columns.test_workouts_data: Tests that the sample workout data has been inserted into theworkoutstable.test_user_workout_data: Tests that the sample workout data has been inserted into theuser_workouttable.
test_profiles_foreign_key: Tests that theprofilestable has a foreign key assigned touser_idand that it references theuserstable.test_goals_foreign_key: Tests that thegoalstable has a foreign key assigned touser_idand that it references theuserstable.test_user_workout_foreign_keys: Tests that theuser_workouttable has correct foreign keys (user_idandworkout_id) that reference the users and workouts tables.
