Esempio n. 1
0
    def test_get_workouts_for_goal_excludes_other_workout_categories(self):
        # register category for goal, connected to "running"
        goal_category = GoalCategoryModel("Distance", "km", 1)
        goal_category.save(commit=False)
        # register category for goal, not connected to "running
        goal_category_other = GoalCategoryModel("Distance", "km", 2)
        goal_category_other.save()
        #register goal
        goal = GoalModel(1, goal_category,
                         dt.datetime.utcnow() - dt.timedelta(days=4),
                         dt.datetime.utcnow() + dt.timedelta(days=4))
        goal.save()
        # register workout for workout category "Running", within goal limits
        running_category = WorkoutCategoryModel.get_by_id(1)
        run_workout = WorkoutModel(1, running_category, "Run",
                                   dt.datetime.utcnow(), 1000, 200, 0, None,
                                   False)
        run_workout.save(commit=False)
        # register workout for workout category "Hiking"
        hiking_category = WorkoutCategoryModel.get_by_id(2)
        hiking_workout = WorkoutModel(
            1, hiking_category, "Hike",
            dt.datetime.utcnow() + dt.timedelta(days=1), 1000, 200, 0, None,
            False)
        hiking_workout.save(commit=True)

        goal_workouts = WorkoutModel.get_workouts_for_goal(goal)
        assert (len(goal_workouts) == 1)
        assert (goal_workouts[0] == run_workout)
Esempio n. 2
0
	def setup(self):
		WorkoutCategoryModel("Running", True).save(commit=False)
		WorkoutCategoryModel("Fitness", False).save()
		self.running_workout_category = WorkoutCategoryModel.get_by_id(1)
		self.fitness_workout_category = WorkoutCategoryModel.get_by_id(2)
		GoalCategoryModel("Cumulative distance", "km", 1).save(commit=False)
		GoalCategoryModel("Number of workouts", "#", 1).save(commit=False)
		GoalCategoryModel("Number of workouts", "#", 2).save(commit=False)
		GoalCategoryModel("Cumulative climb", "m", 1).save(commit=False)
		GoalCategoryModel("Weight loss", "kg", None).save()
		self.cumulative_distance_goal_category = GoalCategoryModel.get_by_id(1)
		self.num_of_running_workouts_goal_category = GoalCategoryModel.get_by_id(2)
		self.num_of_fitness_workouts_goal_category = GoalCategoryModel.get_by_id(3)
		self.cumulative_climb_goal_category = GoalCategoryModel.get_by_id(4)
		self.weight_loss_goal_category = GoalCategoryModel.get_by_id(5)
		two_days_ago = dt.datetime.utcnow() - dt.timedelta(days=2)
		two_days_from_now = dt.datetime.utcnow() + dt.timedelta(days=2)
		GoalModel(self.profile_id, self.cumulative_distance_goal_category, two_days_ago, two_days_from_now, 0, 100, 0).save(commit=False)
		GoalModel(self.profile_id, self.num_of_running_workouts_goal_category, two_days_ago, two_days_from_now, 0, 10, 0).save(commit=False)
		GoalModel(self.profile_id, self.num_of_fitness_workouts_goal_category, two_days_ago, two_days_from_now, 0, 10, 0).save(commit=False)
		GoalModel(self.profile_id, self.cumulative_climb_goal_category, two_days_ago, two_days_from_now, 0, 500, 0).save(commit=False)
		GoalModel(self.profile_id, self.weight_loss_goal_category, two_days_ago, two_days_from_now, 80, 70, 78).save()
		self.cumulative_distance_goal = GoalModel.get_by_id(1)
		self.running_workouts_goal = GoalModel.get_by_id(2)
		self.fitness_workouts_goal = GoalModel.get_by_id(3)
		self.cumulative_climb_goal = GoalModel.get_by_id(4)
		self.weight_loss_goal = GoalModel.get_by_id(5)
Esempio n. 3
0
 def test_find_by_name(self):
     item1 = WorkoutCategoryModel("Running", True)
     item2 = WorkoutCategoryModel("Hiking", True)
     item1.save(commit=False)
     item2.save()
     retrieved_item = WorkoutCategoryModel.find_by_name("Hiking")
     assert (retrieved_item.name == item2.name)
     retrieved_item = WorkoutCategoryModel.find_by_name("Bullshit")
     assert (retrieved_item is None)
Esempio n. 4
0
def _get_workout_category_from_polar_exercise(polar_category, polar_category_detailed):
	if polar_category == 'RUNNING': # detailed can be: RUNNING | TREADMILL_RUNNING
		return WorkoutCategoryModel.find_by_name('Running')
	if polar_category == 'OTHER':
		if polar_category_detailed == "HIKING":
			return WorkoutCategoryModel.find_by_name('Hiking')
		if polar_category_detailed == "STRENGTH_TRAINING":
			return WorkoutCategoryModel.find_by_name('Fitness')
		if polar_category_detailed == "CROSS-COUNTRY_SKIING":
			return WorkoutCategoryModel.find_by_name('Cross-country skiing')
		if polar_category_detailed == "ROLLER_SKIING_FREESTYLE":
			return WorkoutCategoryModel.find_by_name('Roller skiing')
	print(str(dt.datetime.utcnow()), "Dbg:Polar cat={0}, detailed={1}".format(polar_category, polar_category_detailed))
	return None
Esempio n. 5
0
 def test_get_workouts_for_goal_excludes_too_old_and_too_new_workouts(self):
     # register category for goal, connected to "running"
     goal_category = GoalCategoryModel("Distance", "km", 1)
     goal_category.save()
     #register goal
     goal = GoalModel(1, goal_category,
                      dt.datetime.utcnow() - dt.timedelta(days=4),
                      dt.datetime.utcnow() + dt.timedelta(days=4))
     goal.save()
     # register workouts for workout category "Running", within goal limits
     running_category = WorkoutCategoryModel.get_by_id(1)
     run_workout_1 = WorkoutModel(1, running_category, "Run 1",
                                  dt.datetime.utcnow(), 1000, 200, 0, None,
                                  False)
     run_workout_1.save(commit=False)
     run_workout_2 = WorkoutModel(
         1, running_category, "Run 2",
         dt.datetime.utcnow() + dt.timedelta(days=1), 1000, 200, 0, None,
         False)
     run_workout_2.save(commit=False)
     # register workout completed before goal started
     WorkoutModel(1, running_category, "Too early",
                  dt.datetime.utcnow() - dt.timedelta(days=5), 1000, 200, 0,
                  None, False).save(commit=False)
     # register workout completed after goal ended
     WorkoutModel(1, running_category, "Too late",
                  dt.datetime.utcnow() + dt.timedelta(days=5), 1000, 200, 0,
                  None, False).save(commit=True)
     goal_workouts = WorkoutModel.get_workouts_for_goal(goal)
     assert (len(goal_workouts) == 2)
     assert (goal_workouts[0] == run_workout_1)
     assert (goal_workouts[1] == run_workout_2)
Esempio n. 6
0
 def test_workout_category_link(self):
     category = WorkoutCategoryModel.get_by_id(2)
     new_workout = WorkoutModel(1, category, "Hike 1", dt.datetime.utcnow(),
                                1234, 234, 123)
     new_workout.save()
     assert (new_workout.category.id == 2)
     assert (new_workout.category.name == 'Hiking')
Esempio n. 7
0
    def test_get_workouts_for_goal_excludes_other_users_workouts(self):
        # register category for goal, connected to "running"
        goal_category = GoalCategoryModel("Distance", "km", 1)
        goal_category.save()
        #register goal
        goal = GoalModel(1, goal_category,
                         dt.datetime.utcnow() - dt.timedelta(days=4),
                         dt.datetime.utcnow() + dt.timedelta(days=4))
        goal.save()
        # register workout for workout category "Running", within goal limits
        running_category = WorkoutCategoryModel.get_by_id(1)
        run_workout_1 = WorkoutModel(1, running_category, "Run 1",
                                     dt.datetime.utcnow(), 1000, 200, 0, None,
                                     False)
        run_workout_1.save(commit=False)
        # register workout for workout category "Running", within goal limits, but other user
        run_workout_2 = WorkoutModel(
            2, running_category, "Run 2",
            dt.datetime.utcnow() + dt.timedelta(days=1), 1000, 200, 0, None,
            False)
        run_workout_2.save(commit=True)

        goal_workouts = WorkoutModel.get_workouts_for_goal(goal)
        assert (len(goal_workouts) == 1)
        assert (goal_workouts[0] == run_workout_1)
Esempio n. 8
0
 def test_get_by_id(self):
     category = WorkoutCategoryModel.get_by_id(1)
     new_workout = WorkoutModel(1, category, "Run 1", dt.datetime.utcnow(),
                                1234, 234, 123)
     new_workout.save()
     retrieved_workout = WorkoutModel.get_by_id(new_workout.id)
     assert (retrieved_workout == new_workout)
Esempio n. 9
0
 def test_default_resource_path_and_edited(self):
     category = WorkoutCategoryModel.get_by_id(1)
     new_workout = WorkoutModel(1, category, "Hike 1", dt.datetime.utcnow(),
                                1234, 234, 123)
     new_workout.save()
     assert (new_workout.resource_path is None)
     assert (new_workout.edited == False)
Esempio n. 10
0
	def test_category_workout_category_link(self, db):
		WorkoutCategoryModel("Running", True).save()
		item1 = GoalCategoryModel("Run Kms", "km", None)
		item1.save()
		item2 = GoalCategoryModel("Run Kms", "km", 1)
		item2.save()
		assert(item1.workout_category is None)
		assert(item2.workout_category.id == 1)
Esempio n. 11
0
 def setup(self):  # register some workouts
     cat1 = WorkoutCategoryModel('Running', True)
     cat1.save(commit=False)
     cat2 = WorkoutCategoryModel('Hiking', True)
     cat2.save()
     now = dt.datetime.utcnow()
     WorkoutModel(1, cat1, "Run 1", now - dt.timedelta(days=1), 3456, 201,
                  12, 'path/run1.gpx', False).save(commit=False)
     WorkoutModel(1, cat2, "Hike 1", now - dt.timedelta(days=3), 12345,
                  2340, 1102, None, False).save()
Esempio n. 12
0
 def test_two_goals_with_same_category_and_profile(self):
     category = WorkoutCategoryModel.get_by_id(1)
     new_workout1 = WorkoutModel(1, category, "Hike 1",
                                 dt.datetime.utcnow(), 1234, 234, 123)
     new_workout1.save()
     new_workout2 = WorkoutModel(1, category, "Hike 2",
                                 dt.datetime.utcnow(), 1234, 234, 123)
     new_workout2.save()
     assert (WorkoutModel.query.count() == 2)
Esempio n. 13
0
    def test_category_name_unique(self, db):
        item = WorkoutCategoryModel("Running", True)
        item.save()

        try:
            item_new = WorkoutCategoryModel("Running", True)
            item_new.save()
        except:
            db.session.rollback()

        num_items = db.session.query(WorkoutCategoryModel).count()
        assert (num_items == 1)
	def _init_profile_with_workouts(self):
		user = User('user', '*****@*****.**')
		user.save(commit=False)
		profile = Profile(user)
		profile.save(commit=False)
		cat1 = WorkoutCategoryModel('Running', True)
		cat1.save(commit=False)
		cat2 = WorkoutCategoryModel('Swimming', True)
		cat2.save()
		WorkoutModel(profile.id, cat1, "Run 1", dt.datetime.utcnow() - dt.timedelta(days=3), 1000, 180, 10, None, False).save(commit=False)
		WorkoutModel(profile.id, cat1, "Run 2", dt.datetime.utcnow() - dt.timedelta(days=2), 1000, 180, 10, None, False).save(commit=False)
		WorkoutModel(profile.id, cat2, "Swim 1", dt.datetime.utcnow() - dt.timedelta(days=1), 100, 180, 0, None, False).save()
		return profile
Esempio n. 15
0
 def test_pace_and_speed(self):
     category = WorkoutCategoryModel.get_by_id(1)
     new_workout1 = WorkoutModel(1, category, "Run 1", dt.datetime.utcnow(),
                                 10000, 3600, 0)
     new_workout1.save()
     assert (new_workout1.average_speed == 10.0)
     assert (new_workout1.average_pace == "06:00")
     new_workout2 = WorkoutModel(1, category, "Run 2", dt.datetime.utcnow(),
                                 4567, 1627, 0)
     new_workout2.save()
     assert (new_workout2.average_speed == 10.11)
     assert (new_workout2.average_pace == "05:56")
Esempio n. 16
0
 def test_resource_file(self):
     category = WorkoutCategoryModel.get_by_id(1)
     new_workout1 = WorkoutModel(1, category, "Run 1", dt.datetime.utcnow(),
                                 10000, 3600, 0, None)
     new_workout1.save(commit=False)
     new_workout2 = WorkoutModel(1, category, "Run 2", dt.datetime.utcnow(),
                                 4567, 1627, 0, '/path/to/file')
     new_workout2.save()
     assert (new_workout1.resource_path is None)
     assert (new_workout1.resource_file is None)
     assert (new_workout2.resource_path == "/path/to/file")
     assert (new_workout2.resource_file == "file")
Esempio n. 17
0
 def test_values(self):
     category = WorkoutCategoryModel.get_by_id(1)
     now = dt.datetime.utcnow()
     item = WorkoutModel(3, category, "Run 1", now, 1234, 234, 123,
                         '/path/to/file.gpx', True)
     assert (item.profile_id == 3)
     assert (item.category.id == 1)
     assert (item.category_name == "Running")
     assert (item.name == "Run 1")
     assert (item.start_at == now)
     assert (item.distance == 1234)
     assert (item.duration == 234)
     assert (item.climb == 123)
     assert (item.resource_path == '/path/to/file.gpx')
     assert (item.edited == True)
Esempio n. 18
0
def init_database_test_data():
	print('Deleting database data ...')

	from run4it.app.database import db  # noqa
	from run4it.api.user import User, UserConfirmation # noqa
	from run4it.api.profile import Profile, ProfileWeightHistory  # noqa
	from run4it.api.token import TokenRegistry  # noqa
	from run4it.api.discipline import DisciplineModel # noqa
	from run4it.api.goal import GoalModel, GoalCategoryModel # noqa
	from run4it.api.workout import WorkoutCategoryModel, WorkoutModel #noqa
	from run4it.api.polar import PolarUserModel, PolarWebhookExerciseModel

	# delete most stuff
	rows = User.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from User table'.format(rows))

	rows = Profile.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from Profile table'.format(rows))

	rows = UserConfirmation.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from UserConfirmation table'.format(rows))

	rows = TokenRegistry.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from TokenRegistry table'.format(rows))
	
	rows = ProfileWeightHistory.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from ProfileWeightHistory table'.format(rows))
	
	rows = DisciplineModel.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from Discipline table'.format(rows))
	
	rows = GoalModel.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from Goal table'.format(rows))	

	rows = GoalCategoryModel.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from GoalCategory table'.format(rows))
	
	rows = WorkoutModel.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from Workout table'.format(rows))

	rows = WorkoutCategoryModel.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from WorkoutCategory table'.format(rows))
	
	rows = PolarUserModel.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from PolarUser table'.format(rows))

	rows = PolarWebhookExerciseModel.query.delete(False)
	if rows > 0:
		print('Deleted {0} rows from PolarWebhookExercise table'.format(rows))

	db.session.commit()

	# create test items
	user = User('existing', '*****@*****.**', 'pwd') #not confirmed
	profile = Profile(user)
	user.save(commit=False)
	profile.save(commit=False)
	print("Added {0}".format(user))

	user = User('JonnyIT', '*****@*****.**', 'pwd')
	user.confirmed = True
	profile = Profile(user)
	profile.set_weight(79.1)
	profile.set_height(176)
	profile.set_birth_date(1979, 5, 1)
	user.save(commit=False)
	profile.save(commit=False)
	print("Added {0}".format(user))

	user = User('confirm', '*****@*****.**', 'pwd')
	profile = Profile(user)
	profile.set_weight(70.1)
	user.save(commit=False)
	profile.save(commit=False)
	print("Added {0}".format(user)) 

	confirmation = UserConfirmation('confirm', 'correct')
	confirmation.save(commit=False)
	print("Added {0}".format(confirmation))

	discipline = DisciplineModel('10,000m', 10000)
	discipline.save(commit=False)
	print("Added {0}".format(discipline))
	discipline = DisciplineModel('5,000m', 5000)
	discipline.save(commit=False)
	print("Added {0}".format(discipline))
	discipline = DisciplineModel('1,500m', 1500)
	discipline.save(commit=False)
	print("Added {0}".format(discipline))

	workout_cat_run = WorkoutCategoryModel('Running', True)
	workout_cat_run.save(commit=False)
	print("Added {0}".format(workout_cat_run))
	workout_cat = WorkoutCategoryModel('Cross-country skiing', True)
	workout_cat.save(commit=False)
	print("Added {0}".format(workout_cat))
	workout_cat = WorkoutCategoryModel('Roller skiing', True)
	workout_cat.save(commit=False)
	print("Added {0}".format(workout_cat))
	workout_cat_fitness = WorkoutCategoryModel('Fitness', False)
	workout_cat_fitness.save(commit=False)
	print("Added {0}".format(workout_cat_fitness))
	db.session.commit()

	goalCatCumRun = GoalCategoryModel('Cumulative distance', 'km', 1)
	goalCatCumRun.save(commit=False)
	print("Added {0}".format(goalCatCumRun))
	goalCatWeightLoss = GoalCategoryModel('Weight loss', 'kg')
	goalCatWeightLoss.save(commit=False)
	print("Added {0}".format(goalCatWeightLoss))
	goalCatSkiingCount = GoalCategoryModel('Workout count', '#', 2)
	goalCatSkiingCount.save(commit=False)
	print("Added {0}".format(goalCatSkiingCount))
	goalCatFitnessCount = GoalCategoryModel('Workout count', '#', 4) 
	goalCatFitnessCount.save(commit=False)
	print("Added {0}".format(goalCatFitnessCount))
	goalCatCumClimb = GoalCategoryModel('Cumulative climb', 'm', 1) # running
	goalCatCumClimb.save(commit=False)
	print("Added {0}".format(goalCatCumClimb))
	db.session.commit()

	now = dt.datetime.utcnow()
	next_january = dt.datetime(now.year + 1, 1, 1)
	prev_january = dt.datetime(now.year, 1, 1)
	this_month_first = dt.datetime(now.year, now.month, 1)
	next_month_first = this_month_first + dt.timedelta(days=monthrange(this_month_first.year, this_month_first.month)[1])
	last_day_prev_month = this_month_first + dt.timedelta(days=-1)
	prev_month_first = this_month_first + dt.timedelta(days=-monthrange(last_day_prev_month.year, last_day_prev_month.month)[1])
	prev_monday = dt.datetime(now.year, now.month, now.day) + dt.timedelta(days=-now.weekday())

	# future goal
	goal = GoalModel(User.find_by_username('JonnyIT').profile.id, goalCatSkiingCount, next_january, next_january + dt.timedelta(days=100), 0, 30, 0)
	goal.save(commit=False)
	print("Added {0}".format(goal))
	goal = GoalModel(User.find_by_username('JonnyIT').profile.id, goalCatCumRun, next_month_first, next_month_first + dt.timedelta(days=monthrange(next_month_first.year, next_month_first.month)[1]), 0, 100, 0)
	goal.save(commit=False)
	print("Added {0}".format(goal))

	# active goals
	goal = GoalModel(User.find_by_username('JonnyIT').profile.id, goalCatWeightLoss, prev_monday, prev_monday + dt.timedelta(days=8), 79, 76, 77)
	goal.save(commit=False)
	print("Added {0}".format(goal))
	goal = GoalModel(User.find_by_username('JonnyIT').profile.id, goalCatCumRun, this_month_first, next_month_first, 0, 100, 22.666)
	goal.save(commit=False)
	print("Added {0}".format(goal))
	goal = GoalModel(User.find_by_username('JonnyIT').profile.id, goalCatFitnessCount, prev_january, next_january, 0, 20, 4)
	goal.save(commit=False)
	print("Added {0}".format(goal))
	goal = GoalModel(User.find_by_username('JonnyIT').profile.id, goalCatCumClimb, prev_january - dt.timedelta(days=10), next_january, 0, 8848, 2174)
	goal.save(commit=False)
	print("Added {0}".format(goal))

	# expired goals
	goal = GoalModel(User.find_by_username('JonnyIT').profile.id, goalCatCumRun, prev_month_first, this_month_first, 0, 100, 98)
	goal.save(commit=False)
	print("Added {0}".format(goal))
	goal = GoalModel(User.find_by_username('JonnyIT').profile.id, goalCatWeightLoss, prev_month_first, this_month_first, 82, 80, 79)
	goal.save(commit=False)
	print("Added {0}".format(goal))
	db.session.commit()

	# Workouts
	workout = WorkoutModel(User.find_by_username('JonnyIT').profile.id, workout_cat_run, "Åsen run 3", dt.datetime.utcnow(), 7321, 1921, 430)
	workout.save(commit=False)
	print("Added {0}".format(workout))
	workout = WorkoutModel(User.find_by_username('JonnyIT').profile.id, workout_cat_run, "Åsen run 2", dt.datetime.utcnow()-dt.timedelta(seconds=90000), 3000, 658, 621, 'C:/mydev/run4it_backend/run4it/uploads/gpx/test.tcx', 1)
	workout.save(commit=False)
	print("Added {0}".format(workout))
	workout = WorkoutModel(User.find_by_username('JonnyIT').profile.id, workout_cat_run, "Åsen run 1", dt.datetime.utcnow()-dt.timedelta(seconds=180000), 12345, 658, 1123, 'C:/mydev/run4it_backend/run4it/uploads/gpx/test2.tcx', 1)
	workout.save(commit=False)
	print("Added {0}".format(workout))	
	db.session.commit()
	workout = WorkoutModel(User.find_by_username('JonnyIT').profile.id, workout_cat_fitness, "Fitness 1", dt.datetime.utcnow()-dt.timedelta(days=20), 0, 3600, 0)
	workout.save(commit=False)
	print("Added {0}".format(workout))
	workout = WorkoutModel(User.find_by_username('JonnyIT').profile.id, workout_cat_fitness, "Fitness 2", dt.datetime.utcnow()-dt.timedelta(days=17), 0, 3600, 0)
	workout.save(commit=False)
	print("Added {0}".format(workout))	
	workout = WorkoutModel(User.find_by_username('JonnyIT').profile.id, workout_cat_fitness, "Fitness 3", dt.datetime.utcnow()-dt.timedelta(days=15), 0, 3600, 0)
	workout.save(commit=False)
	print("Added {0}".format(workout))
	workout = WorkoutModel(User.find_by_username('JonnyIT').profile.id, workout_cat_fitness, "Fitness 4", dt.datetime.utcnow(), 0, 3600, 0)
	workout.save(commit=False)
	print("Added {0}".format(workout))
	db.session.commit()	

	print('Application data initialized!')
	return 0
Esempio n. 19
0
	def setup(self):
		WorkoutCategoryModel("Running", True).save()
		GoalCategoryModel("RunKms", "km", 1).save(commit=False)
		GoalCategoryModel("WeightTarget").save()
 def setup(self):  # register some workout categories
     WorkoutCategoryModel('Running', True).save(commit=False)
     WorkoutCategoryModel('Fitness', False).save(commit=False)
     WorkoutCategoryModel('Hiking', True).save(commit=True)
Esempio n. 21
0
 def setup(self):
     WorkoutCategoryModel("Running", True).save(commit=False)
     WorkoutCategoryModel("Hiking", True).save()
Esempio n. 22
0
 def setup(self):
     cat1 = WorkoutCategoryModel('Running', True)
     cat1.save(commit=False)
Esempio n. 23
0
	def setup(self): # register some workout categories
		WorkoutCategoryModel('Running', True).save()
		GoalCategoryModel('Distance', 'km', 1).save(commit=False)
		GoalCategoryModel('Abnormal weight loss', 'kg', None).save(commit=False)
		GoalCategoryModel('Weight gain', 'kg').save(commit=True)
Esempio n. 24
0
 def test_get_by_id(self):
     new_item = WorkoutCategoryModel("Running", True)
     new_item.save()
     retrieved_item = WorkoutCategoryModel.get_by_id(new_item.id)
     assert (retrieved_item == new_item)