def setUp(self): self.user = UserFactory() ModuleFactory("a", "/pages/a/") ModuleFactory("b", "/pages/b/") self.hierarchy_a = Hierarchy.objects.get(name='a') self.hierarchy_b = Hierarchy.objects.get(name='b')
def setUp(self): self.user = UserFactory(is_superuser=True) ModuleFactory("one", "/pages/one/") self.hierarchy = Hierarchy.objects.get(name='one') self.section_one = Section.objects.get(slug='one') self.hierarchy.get_root().add_child_section_from_dict({ 'label': 'Page Four', 'slug': 'page-four', 'pageblocks': [{ 'label': 'Content', 'css_extra': '', 'block_type': 'Quiz', 'body': 'random text goes here', 'description': 'a description', 'rhetorical': False, 'questions': [{ 'question_type': 'short text', 'text': 'a question', 'explanation': 'an explanation', 'intro_text': 'intro text', 'answers': [] }] }] }) self.section_four = Section.objects.get(slug='page-four') self.request = RequestFactory().get('/pages/%s/' % self.hierarchy.name) self.request.user = self.user
def setUp(self): self.factory = RequestFactory() ModuleFactory("main", "/pages/main/") self.hierarchy = Hierarchy.objects.get(name='main') root = self.hierarchy.get_root() descendants = root.get_descendants() self.old_group = SchoolGroupFactory(end_date=date(2007, 12, 25), module=self.hierarchy) incomplete_user = \ StudentProfileFactory(school=self.old_group.school).user UserPageVisit.objects.create(user=incomplete_user, section=descendants[0]) self.old_group.userprofile_set.add(incomplete_user.profile) self.new_group = SchoolGroupFactory(end_date=datetime.date.today(), module=self.hierarchy) complete_user = \ StudentProfileFactory(school=self.new_group.school).user self.new_group.userprofile_set.add(complete_user.profile) for section in descendants: UserPageVisit.objects.create(user=complete_user, section=section) inprogress_user = \ StudentProfileFactory(school=self.new_group.school).user self.new_group.userprofile_set.add(inprogress_user.profile) UserPageVisit.objects.create(user=inprogress_user, section=descendants[0]) self.icap = ICAPProfileFactory( country=self.new_group.school.country).user self.student = StudentProfileFactory( country=self.old_group.school.country).user # unaffiliated user
def setUp(self): self.teacher = TeacherProfileFactory().user self.school = SchoolFactory() self.client = Client() ModuleFactory("main", "/pages/main/") self.hierarchy = Hierarchy.objects.get(name='main')
def setUp(self): super(VideoAnalyticsReportTest, self).setUp() self.participant = UserFactory() self.participant2 = UserFactory() block = YouTubeBlock() block.video_id = 'avideo' block.language = 'a' block.title = 'Title' block.save() ModuleFactory("a", "/pages/a/") self.hierarchy_a = Hierarchy.objects.get(name='a') section = self.hierarchy_a.get_root().get_next() section.append_pageblock('Video 1', '', content_object=block) sections = self.hierarchy_a.get_root().get_descendants() UserPageVisit.objects.create(user=self.participant, section=sections[0], status="complete") UserPageVisit.objects.create(user=self.participant, section=sections[1], status="complete") UserVideoView.objects.create(user=self.participant, video_id='avideo', seconds_viewed=50, video_duration=200) self.report = VideoAnalyticsReport()
def setUp(self): self.student = StudentProfileFactory().user self.teacher = TeacherProfileFactory().user self.school_admin = InstitutionAdminProfileFactory().user self.country_admin = CountryAdministratorProfileFactory().user self.icap = ICAPProfileFactory().user ModuleFactory("main", "/") self.hierarchy = Hierarchy.objects.get(name='main')
def setUp(self): ModuleFactory("main", "/pages/main/") self.hierarchy = Hierarchy.objects.get(name='main') self.section = self.hierarchy.get_root().get_first_leaf() self.student = StudentProfileFactory().user self.client = Client() self.client.login(username=self.student.username, password="******")
def setUp(self): self.user = UserFactory(is_superuser=True) ModuleFactory('one', '/pages/one/') self.hierarchy = Hierarchy.objects.get(name='one') self.sections = self.hierarchy.get_root().get_descendants() self.request = RequestFactory().get('/pages/%s/' % self.hierarchy.name) self.request.user = self.user
def setUp(self): ModuleFactory("one", "/pages/one/") self.hierarchy = Hierarchy.objects.get(name='one') self.section = self.hierarchy.get_root().get_first_leaf() # Setup 4 scorable blocks # quiz self.quiz = Quiz.objects.create() self.question = Question.objects.create( quiz=self.quiz, text="single", question_type="single choice") Answer.objects.create(question=self.question, label="a", value="a", correct=True) Answer.objects.create(question=self.question, label="b", value="b") self.section.append_pageblock("Quiz One", "pretest", self.quiz) # conversation self.scenario = ConversationScenarioFactory() good_click = ConvClick.objects.create( conversation=self.scenario.good_conversation) bad_click = ConvClick.objects.create( conversation=self.scenario.bad_conversation) self.section.append_pageblock("Conversation", "bar", self.scenario) # dosage activity self.dosage = DosageActivity.objects.create( ml_nvp=0.4, times_day=2, weeks=1) self.section.append_pageblock("Dosage", "", self.dosage) # calendar activity month = MonthFactory() self.chart = CalendarChartFactory(month=month) chart_good_click = Day.objects.create(calendar=month, number=4) self.section.append_pageblock("Calendar", "", self.chart) self.userNoAnswers = UserFactory() self.userIncomplete = UserFactory() self.set_quiz_response(self.userIncomplete, 'b') self.set_conversation_response(self.userIncomplete, good_click, bad_click) self.userBadScore = UserFactory() self.set_quiz_response(self.userBadScore, 'a') self.set_conversation_response(self.userBadScore, bad_click, good_click) self.set_dosage_response(self.userBadScore, 0.4, 2, 2) self.set_calendar_response(self.userBadScore, chart_good_click, chart_good_click) self.userGoodScore = UserFactory() self.set_quiz_response(self.userGoodScore, 'a') self.set_conversation_response(self.userGoodScore, good_click, bad_click) self.set_dosage_response(self.userGoodScore, 0.4, 2, 1) self.set_calendar_response(self.userGoodScore, chart_good_click, chart_good_click)
def setUp(self): ModuleFactory("main", "/pages/main/") self.hierarchy = Hierarchy.objects.get(name='main') self.section = self.hierarchy.get_root().get_first_leaf() self.admin = InstitutionAdminProfileFactory().user self.client = Client() self.client.login(username=self.admin.username, password="******") self.teacher = TeacherProfileFactory( school=self.admin.profile.school).user
def setUp(self): ModuleFactory("main", "/pages/main/") self.hierarchy = get_hierarchy(name='main') self.section = self.hierarchy.get_root().get_first_leaf() self.grp_usr_profile = GroupUpFactory() self.grp_usr_profile.user.set_password("test") self.grp_usr_profile.user.save() self.client = Client() self.client.login( username=self.grp_usr_profile.user.username, password="******")
def setUp(self): self.user = UserFactory() self.user.profile.research_group = 'one' self.user.profile.save() self.quiz = Quiz.objects.create() ModuleFactory('one', '/pages/one/') section = Section.objects.get(slug='one') section.append_pageblock('Q', 'assessment', content_object=self.quiz) self.ques1 = Question.objects.create(quiz=self.quiz, text='one', question_type='single choice', css_extra='t1', explanation='a') Answer.objects.create(question=self.ques1, label='a', value='a', correct=True) Answer.objects.create(question=self.ques1, label='b', value='b') self.ques2 = Question.objects.create(quiz=self.quiz, text='two', question_type='single choice', css_extra='t1', explanation='a') Answer.objects.create(question=self.ques2, label='a', value='a', correct=True) Answer.objects.create(question=self.ques2, label='b', value='b') self.ques3 = Question.objects.create(quiz=self.quiz, text='three', question_type='single choice', css_extra='t1', explanation='a') Answer.objects.create(question=self.ques3, label='a', value='a', correct=True) Answer.objects.create(question=self.ques3, label='b', value='b') ques4 = Question.objects.create(quiz=self.quiz, text='four', question_type='single choice', css_extra='t2', explanation='b') Answer.objects.create(question=ques4, label='a', value='a', correct=True) Answer.objects.create(question=ques4, label='b', value='b')
def test_basics(self): block = YouTubeBlockFactory() ModuleFactory("one", "/pages/one/") self.hierarchy = Hierarchy.objects.get(name='one') self.section_one = Section.objects.get(slug='one') self.section_one.append_pageblock('test', '', block) self.assertTrue(block.__str__().startswith('One')) self.assertIsNotNone(block.pageblock()) self.assertFalse(block.needs_submit()) self.assertTrue(block.unlocked(None))
def setUp(self): ModuleFactory("one", "/pages/one/") self.hierarchy = Hierarchy.objects.get(name='one') self.section = self.hierarchy.get_root().get_first_leaf() # Setup a quiz block self.quiz = Quiz.objects.create() self.question = Question.objects.create( quiz=self.quiz, text="single", question_type="single choice") Answer.objects.create(question=self.question, label="a", value="a", correct=True) Answer.objects.create(question=self.question, label="b", value="b") self.section.append_pageblock("Quiz One", "adherence", self.quiz)
def setUp(self): ModuleFactory("one", "/pages/one/") self.hierarchy = Hierarchy.objects.get(name='one') section = self.hierarchy.get_root().get_first_leaf() self.user = User.objects.create(username="******") self.user2 = User.objects.create(username="******") self.quiz = Quiz.objects.create() section.append_pageblock("Quiz One", "satisfaction", self.quiz) # 2 questions self.question = Question.objects.create(quiz=self.quiz, text="single answer", question_type="single choice") Answer.objects.create(question=self.question, label="1", value="1") Answer.objects.create(question=self.question, label="4", value="4") Answer.objects.create(question=self.question, label="5", value="5") Question.objects.create(quiz=self.quiz, text="s", question_type="long text")
def setUp(self): ModuleFactory("one", "/pages/one/") self.hierarchy = Hierarchy.objects.get(name='one') self.section = self.hierarchy.get_root().get_first_leaf() self.user = User.objects.create(username="******") self.user2 = User.objects.create(username="******") self.quiz1 = Quiz.objects.create() self.quiz2 = Quiz.objects.create() self.section.append_pageblock("Quiz One", 'foo', self.quiz1) self.section.append_pageblock("Quiz Two", 'foo', self.quiz2) # 4 questions self.single = Question.objects.create(quiz=self.quiz1, text="single answer", question_type="single choice") Answer.objects.create(question=self.single, label="a", value="a", correct=True) Answer.objects.create(question=self.single, label="b", value="b") self.multiple = Question.objects.create( quiz=self.quiz1, text="multiple answer", question_type="multiple choice") Answer.objects.create(question=self.multiple, label="a", value="a", correct=True) Answer.objects.create(question=self.multiple, label="b", value="b", correct=True) Answer.objects.create(question=self.multiple, label="c", value="c") self.short_text = Question.objects.create(quiz=self.quiz2, text="short text", question_type="short text") self.long_text = Question.objects.create(quiz=self.quiz2, text="long text", question_type="long text")
def setUp(self): ModuleFactory("main", "/pages/main/") self.hierarchy = Hierarchy.objects.get(name='main') self.section = self.hierarchy.get_root().get_first_leaf() self.factory = RequestFactory()
def setUp(self): self.user = UserFactory() ModuleFactory("main", "/pages/main/") hierarchy = Hierarchy.objects.get(name='main') self.section = hierarchy.get_root().get_first_leaf()