def setUp(self):
        super().setUp()

        self.user_rule = UserRule()
        self.user = self.user_rule.user

        self.wet = WatchEventTypeRule()
    def setUp(self):
        super().setUp()

        self.BOOKMARK_COUNT = 20

        self.user_rule = UserRule()
        self.user_rule.add_bookmarks(self.BOOKMARK_COUNT, exercises_count=1)
        self.user = self.user_rule.user
    def setUp(self):
        super().setUp()

        self.NUM_BOOKMARKS = 5

        self.user_rule = UserRule()
        self.user_rule.add_bookmarks(self.NUM_BOOKMARKS)
        self.user = self.user_rule.user
        self.NUM_BOOKMARKS = len(self.user.all_bookmarks_fit_for_study())
    def __init__(self):
        super().__init__()
        self.cohort = self._create_model_object()
        self.save(self.cohort)

        self.teacher = UserRule().user
        self.save(self.teacher)

        teacher_role = TeacherCohortMap(self.teacher, self.cohort)
        self.save(teacher_role)

        self.student1 = UserRule().user
        self.student1.cohort = self.cohort
        self.save(self.student1)

        student2 = UserRule().user
        student2.cohort = self.cohort
        self.save(student2)
Example #5
0
    def _create_model_object(self):
        user = UserRule().user
        article = ArticleRule().article

        user_article = UserArticle(user, article)

        if self._exists_in_db(user_article):
            return self._create_model_object()

        return user_article
Example #6
0
    def setUp(self):
        super().setUp()

        self.user_rule = UserRule()
        self.user = self.user_rule.user
        self.db.session.add(self.user)
        self.db.session.commit()

        self.random_origin_word = self.faker.word()
        self.random_origin_language = LanguageRule().random
        self.user_word_rule = UserWordRule(self.random_origin_word,
                                           self.random_origin_language)

        self.text = "This sentence, taken as a reading passage unto itself, is being used to prove a point."
        self.english = LanguageRule().get_or_create_language("en")
Example #7
0
    def test_create_anonymous(self):
        self.user = UserRule().user
        new_password = self.faker.password()
        self.user.update_password(new_password)

        user_to_check = User.create_anonymous(
            str(self.user.id),
            new_password,
            self.user.learned_language.code,
            self.user.native_language.code,
        )

        assert user_to_check.email == str(
            self.user.id) + User.ANONYMOUS_EMAIL_DOMAIN
        assert user_to_check.name == str(self.user.id)
        assert user_to_check.learned_language == self.user.learned_language
        assert user_to_check.native_language == self.user.native_language
    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
 def setUp(self):
     super().setUp()
     self.user = UserRule().user
Example #10
0
    def setUp(self):
        super().setUp()

        self.text_rule = TextRule()
        self.user_rule = UserRule()
        self.bookmark_rule = BookmarkRule(self.user_rule.user)
Example #11
0
 def setUp(self):
     super().setUp()
     self.user_rule = UserRule()
     self.user_rule.add_bookmarks(random.randint(1, 5))
     self.user = self.user_rule.user
Example #12
0
 def setUp(self):
     super().setUp()
     self.lan = LanguageRule().de
     self.user = UserRule().user