Exemplo n.º 1
0
    def _create_model_object(self):
        user_rule = UserRule()

        cohort = CohortRule()
        user = cohort.student1

        #UserRule and CohortRule give different user.id, therefore we equalize them so that all the information refers
        #to the same user
        user = user_rule.user

        start_time = datetime.now() - timedelta(minutes=randint(0, 7200))

        bookmark_rules = user_rule.add_bookmarks(bookmark_count=3,
                                                 exercises_count=3)
        self.user = user_rule.user
        self.bookmark = bookmark_rules[0].bookmark

        exercise_session = UserExerciseSession(user.id, start_time)

        return exercise_session
Exemplo n.º 2
0
 def test__is_not_same_exercise_session(self):
     new_exercise_session = UserExerciseSession(self.ex_session1.user_id,
                                                datetime.now())
     new_exercise_session.last_action_time = self.SOME_TIME_AGO
     new_exercise_session.start_time = self.A_BIT_LATER_THAN_SOME_TIME_AGO
     assert (False == new_exercise_session._is_still_active())