예제 #1
0
파일: tests.py 프로젝트: ftzm/muscleup
    def test_assign_exercises_to_routineday(self):
        routineday = RoutineDay(
            name="RoutineDay One",
            routine=Routine.objects.get(name="Routine One"))
        routineday.save()

        exercise = Exercise.objects.create(name="Situp")
        routineday.add_exercise(exercise)

        self.assertEqual(routineday.routinedayslots.count(), 1)
        self.assertEqual(
            routineday.routinedayslots.first().exercise.name, "Situp")
예제 #2
0
    def setUp(self):
        create_user()

        first_routine = Routine()
        first_routine.name = "Spring Workout"
        first_routine.cycle_length = 7
        first_routine.cycle_position = 1
        first_routine.cycle_last_set = \
            datetime.date.today() - datetime.timedelta(1)
        first_routine.save()

        first_routineday = RoutineDay()
        first_routineday.name = "A"
        first_routineday.routine = Routine.objects.get(name="Spring Workout")
        first_routineday.position = 7
        first_routineday.save()

        exercise_names = ["Pushup", "Pullup", "Squat", "Plank"]
        exercises = [
            Exercise.objects.create(name=name) for name in exercise_names
        ]

        for exercise in exercises:
            RoutineDaySlot.objects.create(exercise=exercise,
                                          routineday=first_routineday,
                                          reps_min=5,
                                          reps_max=5,
                                          reps_step=0,
                                          sets_min=5,
                                          sets_max=5,
                                          weight_step=5)

        workout = Workout.objects.create_workout(routineday=first_routineday,
                                                 owner=get_user())
예제 #3
0
    def test_remove_exercises_from_routineday(self):
        routineday = RoutineDay(
            name="RoutineDay One",
            routine=Routine.objects.get(name="Routine One"))
        routineday.save()
        exercise = Exercise.objects.create(name="Situp")
        routineday.add_exercise(exercise)

        routineday.remove_exercise(exercise.name)

        self.assertEqual(routineday.routinedayslots.count(), 0)
예제 #4
0
    def test_no_invalid_position(self):
        first_routineday = RoutineDay()
        first_routineday.name = "RoutineDay One"
        first_routineday.routine = Routine.objects.get(name="Routine One")
        first_routineday.save()

        first_routineday.position = 9

        self.assertEqual(first_routineday.position, 1)
예제 #5
0
파일: tests.py 프로젝트: ftzm/muscleup
    def test_remove_exercises_from_routineday(self):
        routineday = RoutineDay(
            name="RoutineDay One",
            routine=Routine.objects.get(name="Routine One"))
        routineday.save()
        exercise = Exercise.objects.create(name="Situp")
        routineday.add_exercise(exercise)

        routineday.remove_exercise(exercise.name)

        self.assertEqual(routineday.routinedayslots.count(), 0)
예제 #6
0
파일: tests.py 프로젝트: ftzm/muscleup
    def test_no_invalid_position(self):
        first_routineday = RoutineDay()
        first_routineday.name = "RoutineDay One"
        first_routineday.routine = Routine.objects.get(name="Routine One")
        first_routineday.save()

        first_routineday.position = 9

        self.assertEqual(first_routineday.position, 1)
예제 #7
0
    def test_assign_exercises_to_routineday(self):
        routineday = RoutineDay(
            name="RoutineDay One",
            routine=Routine.objects.get(name="Routine One"))
        routineday.save()

        exercise = Exercise.objects.create(name="Situp")
        routineday.add_exercise(exercise)

        self.assertEqual(routineday.routinedayslots.count(), 1)
        self.assertEqual(routineday.routinedayslots.first().exercise.name,
                         "Situp")
예제 #8
0
    def test_keep_workoutday_positions_inbounds(self):
        first_routine = Routine()
        first_routine.name = "Routine One"
        first_routine.cycle_length = 7
        first_routine.cycle_position = 1
        first_routine.cycle_last_set = \
            datetime.date.today() - datetime.timedelta(1)
        first_routine.save()
        first_routineday = RoutineDay()
        first_routineday.name = "RoutineDay One"
        first_routineday.routine = Routine.objects.get(name="Routine One")
        first_routineday.position = 7
        first_routineday.save()

        first_routine.cycle_length = 3
        first_routine.save()

        first_routineday = RoutineDay.objects.get(name="RoutineDay One")
        self.assertEqual(first_routineday.position, 3)
예제 #9
0
파일: tests.py 프로젝트: ftzm/muscleup
    def test_keep_workoutday_positions_inbounds(self):
        first_routine = Routine()
        first_routine.name = "Routine One"
        first_routine.cycle_length = 7
        first_routine.cycle_position = 1
        first_routine.cycle_last_set = \
            datetime.date.today() - datetime.timedelta(1)
        first_routine.save()
        first_routineday = RoutineDay()
        first_routineday.name = "RoutineDay One"
        first_routineday.routine = Routine.objects.get(name="Routine One")
        first_routineday.position = 7
        first_routineday.save()

        first_routine.cycle_length = 3
        first_routine.save()

        first_routineday = RoutineDay.objects.get(name="RoutineDay One")
        self.assertEqual(first_routineday.position, 3)
예제 #10
0
파일: tests.py 프로젝트: ftzm/muscleup
    def setUp(self):
        create_user()

        first_routine = Routine()
        first_routine.name = "Spring Workout"
        first_routine.cycle_length = 7
        first_routine.cycle_position = 1
        first_routine.cycle_last_set = \
            datetime.date.today() - datetime.timedelta(1)
        first_routine.save()

        first_routineday = RoutineDay()
        first_routineday.name = "A"
        first_routineday.routine = Routine.objects.get(name="Spring Workout")
        first_routineday.position = 7
        first_routineday.save()

        exercise_names = ["Pushup", "Pullup", "Squat", "Plank"]
        exercises = [Exercise.objects.create(name=name)
                     for name in exercise_names]

        for exercise in exercises:
            RoutineDaySlot.objects.create(
                exercise=exercise,
                routineday=first_routineday,
                reps_min=5,
                reps_max=5,
                reps_step=0,
                sets_min=5,
                sets_max=5,
                weight_step=5
            )

        workout = Workout.objects.create_workout(
            routineday=first_routineday,
            owner=get_user()
        )
예제 #11
0
    def setUp(self):
        first_routine = Routine()
        first_routine.name = "Spring Workout"
        first_routine.cycle_length = 7
        first_routine.cycle_position = 1
        first_routine.cycle_last_set = \
            datetime.date.today() - datetime.timedelta(1)
        first_routine.save()

        first_routineday = RoutineDay()
        first_routineday.name = "A"
        first_routineday.routine = Routine.objects.get(name="Spring Workout")
        first_routineday.position = 7
        first_routineday.save()

        second_routineday = RoutineDay()
        second_routineday.name = "B"
        second_routineday.routine = Routine.objects.get(name="Spring Workout")
        second_routineday.position = 7
        second_routineday.save()

        create_user()
예제 #12
0
    def test_saving_and_retrieving_routineday(self):
        first_routineday = RoutineDay()
        first_routineday.name = "RoutineDay One"
        first_routineday.routine = Routine.objects.get(name="Routine One")
        first_routineday.position = 3
        first_routineday.save()

        second_routineday = RoutineDay()
        second_routineday.name = "RoutineDay Two"
        second_routineday.routine = Routine.objects.get(name="Routine One")
        second_routineday.position = 5
        second_routineday.save()

        saved_routinedays = RoutineDay.objects.all()
        self.assertEqual(saved_routinedays.count(), 2)

        first_saved_routineday = saved_routinedays[0]
        second_saved_routineday = saved_routinedays[1]
        self.assertEqual(first_saved_routineday.name, "RoutineDay One")
        self.assertEqual(first_saved_routineday.routine,
                         Routine.objects.get(name="Routine One"))
        self.assertEqual(first_saved_routineday.position, 3)
        self.assertEqual(second_saved_routineday.name, "RoutineDay Two")
        self.assertEqual(second_saved_routineday.routine,
                         Routine.objects.get(name="Routine One"))
        self.assertEqual(second_saved_routineday.position, 5)
예제 #13
0
파일: tests.py 프로젝트: ftzm/muscleup
    def setUp(self):
        first_routine = Routine()
        first_routine.name = "Spring Workout"
        first_routine.cycle_length = 7
        first_routine.cycle_position = 1
        first_routine.cycle_last_set = \
            datetime.date.today() - datetime.timedelta(1)
        first_routine.save()

        first_routineday = RoutineDay()
        first_routineday.name = "A"
        first_routineday.routine = Routine.objects.get(name="Spring Workout")
        first_routineday.position = 7
        first_routineday.save()

        second_routineday = RoutineDay()
        second_routineday.name = "B"
        second_routineday.routine = Routine.objects.get(name="Spring Workout")
        second_routineday.position = 7
        second_routineday.save()

        create_user()
예제 #14
0
파일: tests.py 프로젝트: ftzm/muscleup
    def test_saving_and_retrieving_routineday(self):
        first_routineday = RoutineDay()
        first_routineday.name = "RoutineDay One"
        first_routineday.routine = Routine.objects.get(name="Routine One")
        first_routineday.position = 3
        first_routineday.save()

        second_routineday = RoutineDay()
        second_routineday.name = "RoutineDay Two"
        second_routineday.routine = Routine.objects.get(name="Routine One")
        second_routineday.position = 5
        second_routineday.save()

        saved_routinedays = RoutineDay.objects.all()
        self.assertEqual(saved_routinedays.count(), 2)

        first_saved_routineday = saved_routinedays[0]
        second_saved_routineday = saved_routinedays[1]
        self.assertEqual(first_saved_routineday.name, "RoutineDay One")
        self.assertEqual(first_saved_routineday.routine,
                         Routine.objects.get(name="Routine One"))
        self.assertEqual(first_saved_routineday.position, 3)
        self.assertEqual(second_saved_routineday.name, "RoutineDay Two")
        self.assertEqual(second_saved_routineday.routine,
                         Routine.objects.get(name="Routine One"))
        self.assertEqual(second_saved_routineday.position, 5)