def setUp(self): super(SharedCoursesListViewTests, self).setUp() self.unit2 = Unit(title='Test title2', addedBy=self.user) self.unit2.save() self.course2 = Course(title='Test title2', description='test description2', access='Public2', enrollCode='1112', lockout='1222', addedBy=self.user) self.course2.save() self.courseunit2 = CourseUnit( unit=self.unit2, course=self.course, order=0, addedBy=self.user, releaseTime=timezone.now() ) self.courseunit2.save() self.courseunit3 = CourseUnit( unit=self.unit, course=self.course2, order=0, addedBy=self.user, releaseTime=timezone.now() ) self.courseunit3.save() enroll_unit_code = EnrollUnitCode.get_code(self.courseunit, give_instance=True) enroll_unit_code2 = EnrollUnitCode.get_code(self.courseunit2, give_instance=True) enroll_unit_code3 = EnrollUnitCode.get_code(self.courseunit3, give_instance=True) self.tester_shared_course = Invite.create_new( invite_type='tester', commit=True, instructor=self.instructor2, email=self.user.email, course=self.course, enroll_unit_code=enroll_unit_code ) self.tester_shared_course2 = Invite.create_new( invite_type='tester', commit=True, instructor=self.instructor2, email=self.user.email, course=self.course, enroll_unit_code=enroll_unit_code2 ) self.tester_shared_course3 = Invite.create_new( invite_type='tester', commit=True, instructor=self.instructor2, email=self.user.email, course=self.course2, enroll_unit_code=enroll_unit_code3 ) self.url = reverse('ctms:shared_courses')
def setUp(self): self.username, self.password = '******', 'test' self.user = User.objects.create_user('test', '*****@*****.**', 'test') self.instructor = Instructor.objects.create(user=self.user, institution='institute', what_do_you_teach='something') self.user2 = User.objects.create_user('test1', '*****@*****.**', 'test') self.instructor2 = Instructor.objects.create(user=self.user2, institution='institution', what_do_you_teach='something') self.unit = Unit(title='Test title', addedBy=self.user) self.unit.save() self.course = Course(title='Test title', description='test description', access='Public', enrollCode='111', lockout='222', addedBy=self.user) self.course.save() self.courseunit = CourseUnit( unit=self.unit, course=self.course, order=0, addedBy=self.user, releaseTime=timezone.now() ) self.courseunit.save() self.lesson = Lesson(title='title', text='text', addedBy=self.user) self.lesson.save() self.unitlesson = UnitLesson( unit=self.unit, order=0, lesson=self.lesson, addedBy=self.user, treeID=self.lesson.id ) self.unitlesson.save() self.client.login(username=self.username, password=self.password) self.url = reverse('ctms:my_courses')
def setUp(self): self.user = User.objects.create_user(username='******', password='******') self.client.login(username='******', password='******') self.course = Course(title='test_title', addedBy=self.user) self.course.save() self.unit = Unit(title='test unit title', addedBy=self.user) self.unit.save() self.course_unit = CourseUnit(course=self.course, unit=self.unit, order=0, addedBy=self.user) self.course_unit.save() self.role = Role(course=self.course, user=self.user, role=Role.INSTRUCTOR) self.role.save() self.concept = Concept.new_concept('bad', 'idea', self.unit, self.user) self.lesson = Lesson(title='New York Test Lesson', text='brr', addedBy=self.user) self.lesson.save_root(self.concept) self.unit_lesson = UnitLesson(unit=self.unit, lesson=self.lesson, addedBy=self.user, treeID=self.lesson.id) self.unit_lesson.save()
def setUp(self): self.user = User.objects.create_user(username='******', password='******') self.client.login(username='******', password='******') self.course = Course(title='test_title', addedBy=self.user) self.course.save() self.unit = Unit(title='test unit title', addedBy=self.user) self.unit.save() self.course_unit = CourseUnit( course=self.course, unit=self.unit, order=0, addedBy=self.user ) self.course_unit.releaseTime = timezone.now() - datetime.timedelta(days=1) self.course_unit.save() self.enroll = EnrollUnitCode(courseUnit=self.course_unit) self.enroll.save() self.role = Role(course=self.course, user=self.user, role=Role.INSTRUCTOR) self.role.save() self.student_role = Role(course=self.course, user=self.user, role=Role.ENROLLED) self.student_role.save() self.concept = Concept.new_concept('bad', 'idea', self.unit, self.user) self.lesson = Lesson( title='New York Test Lesson', text='brr', addedBy=self.user, kind=Lesson.ORCT_QUESTION ) self.lesson.save_root(self.concept) self.unit_lesson = UnitLesson( unit=self.unit, lesson=self.lesson, addedBy=self.user, treeID=self.lesson.id, order=0 ) self.unit_lesson.save() self.unit_lesson_answer = UnitLesson( parent=self.unit_lesson, unit=self.unit, lesson=self.lesson, addedBy=self.user, treeID=self.lesson.id, kind=UnitLesson.ANSWERS ) self.unit_lesson_answer.save() self.user = User.objects.create_user(username='******', password='******') call_command('fsm_deploy')
def setUp(self): """ Preconditions. """ self.client = Client() self.user = User.objects.create_user('test', '*****@*****.**', 'test') mocked_nonce = u'135685044251684026041377608307' mocked_timestamp = u'1234567890' mocked_decoded_signature = u'my_signature=' self.headers = { u'user_id': 1, u'lis_person_name_full': u'Test Username', u'lis_person_name_given': u'First', u'lis_person_name_family': u'Second', u'lis_person_contact_email_primary': u'*****@*****.**', u'lis_person_sourcedid': u'Test_Username', u'oauth_callback': u'about:blank', u'launch_presentation_return_url': '', u'lti_message_type': u'basic-lti-launch-request', u'lti_version': 'LTI-1p0', u'roles': u'Student', u'context_id': 1, u'tool_consumer_info_product_family_code': u'moodle', u'context_title': u'Test title', u'tool_consumer_instance_guid': u'test.dot.com', u'resource_link_id': 'dfgsfhrybvrth', u'lis_result_sourcedid': 'wesgaegagrreg', u'oauth_nonce': mocked_nonce, u'oauth_timestamp': mocked_timestamp, u'oauth_consumer_key': u'', u'oauth_signature_method': u'HMAC-SHA1', u'oauth_version': u'1.0', u'oauth_signature': mocked_decoded_signature } self.unit = Unit(title='Test title', addedBy=self.user) self.unit.save() self.course = Course(title='Test title', description='test description', access='Public', enrollCode='111', lockout='222', addedBy=self.user) self.course.save() self.course_ref = CourseRef( course=self.course, context_id=self.headers.get('context_id'), tc_guid=self.headers.get('tool_consumer_instance_guid')) self.course_ref.save() self.course_ref.instructors.add(self.user) self.courseunit = CourseUnit(unit=self.unit, course=self.course, order=0, addedBy=self.user) self.courseunit.save()
def setUp(self): self.client = Client() self.user = User.objects.create_user('test', '*****@*****.**', 'test') get_specs()[0].save_graph(self.user.username) get_specs_additional()[0].save_graph(self.user.username) get_specs_resource()[0].save_graph(self.user.username) self.unit = Unit(title='Test title', addedBy=self.user) self.unit.save() self.course = Course(title='Test title', description='test description', access='Public', enrollCode='111', lockout='222', addedBy=self.user) self.course.save() self.courseunit = CourseUnit( unit=self.unit, course=self.course, order=0, addedBy=self.user, releaseTime=timezone.now() ) self.courseunit.save() self.concept = Concept.new_concept('bad', 'idea', self.unit, self.user) lesson = Lesson(title='title', text='text', addedBy=self.user) lesson.save() self.unitlesson = UnitLesson( unit=self.unit, order=0, lesson=lesson, addedBy=self.user, treeID=lesson.id ) self.unitlesson.save() resource_lesson = Lesson( title='title for resource', text='text for resource', addedBy=self.user ) resource_lesson.save() self.resource_unitlesson = UnitLesson( unit=self.unit, lesson=resource_lesson, addedBy=self.user, treeID=resource_lesson.id ) self.resource_unitlesson.save()
def setUp(self): self.user = User.objects.create_user(username='******', password='******') self.client.login(username='******', password='******') self.course = Course(title='test_title', addedBy=self.user) self.course.save() self.unit = Unit(title='test unit title', addedBy=self.user) self.unit.save() self.course_unit = CourseUnit(course=self.course, unit=self.unit, order=0, addedBy=self.user) self.course_unit.save() self.role = Role(course=self.course, user=self.user, role=Role.INSTRUCTOR) self.role.save() self.enroll = EnrollUnitCode.get_code_for_user_chat(self.course_unit, True, self.user) self.history_live_chat = Chat( user=self.user, is_live=True, enroll_code=self.enroll ) self.history_live_chat.save()
def setUp(self): """ Preconditions. """ from chat.fsm_plugin.chat import get_specs from chat.fsm_plugin.additional import get_specs as get_specs_additional self.client = Client() self.user = User.objects.create_user('test', '*****@*****.**', 'test') get_specs()[0].save_graph(self.user.username) get_specs_additional()[0].save_graph(self.user.username) mocked_nonce = '135685044251684026041377608307' mocked_timestamp = '1234567890' mocked_decoded_signature = 'my_signature=' self.headers = { 'user_id': 1, 'lis_person_name_full': 'Test Username', 'lis_person_name_given': 'First', 'lis_person_name_family': 'Second', 'lis_person_contact_email_primary': '*****@*****.**', 'lis_person_sourcedid': 'Test_Username', 'oauth_callback': 'about:blank', 'launch_presentation_return_url': '', 'lti_message_type': 'basic-lti-launch-request', 'lti_version': 'LTI-1p0', 'roles': 'Student', 'context_id': 1, 'tool_consumer_info_product_family_code': 'moodle', 'context_title': 'Test title', 'tool_consumer_instance_guid': 'test.dot.com', 'resource_link_id': 'dfgsfhrybvrth', 'lis_result_sourcedid': 'wesgaegagrreg', 'oauth_nonce': mocked_nonce, 'oauth_timestamp': mocked_timestamp, 'oauth_consumer_key': 'consumer_key', 'oauth_signature_method': 'HMAC-SHA1', 'oauth_version': '1.0', 'oauth_signature': mocked_decoded_signature } self.unit = Unit(title='Test title', addedBy=self.user) self.unit.save() self.course = Course(title='Test title', description='test description', access='Public', enrollCode='111', lockout='222', addedBy=self.user) self.course.save() self.course_ref = CourseRef( course=self.course, context_id=self.headers.get('context_id'), tc_guid=self.headers.get('tool_consumer_instance_guid')) self.course_ref.save() self.course_ref.instructors.add(self.user) self.role1 = Role( role=Role.ENROLLED, user=self.user, course=self.course, ) self.role1.save() self.courseunit = CourseUnit(unit=self.unit, course=self.course, order=0, addedBy=self.user, releaseTime=timezone.now()) self.courseunit.save() lesson = Lesson(title='title', text='text', addedBy=self.user) lesson.save() unitlesson = UnitLesson(unit=self.unit, order=0, lesson=lesson, addedBy=self.user, treeID=lesson.id) unitlesson.save() self.lti_consumer = LtiConsumer(consumer_name='test', consumer_key='consumer_key', consumer_secret='test_key') self.lti_consumer.save()
def setUp(self): self.username, self.password = '******', 'test' self.user = User.objects.create_user(self.username, '*****@*****.**', self.password) self.instructor = Instructor.objects.create(user=self.user, institution='institute', what_do_you_teach='something') self.username2, self.password2 = 'test1', 'test' self.user2 = User.objects.create_user(self.username2, '*****@*****.**', self.password2) self.instructor2 = Instructor.objects.create(user=self.user2, institution='institute', what_do_you_teach='something') self.unit = Unit(title='Test title', addedBy=self.user) self.unit.save() self.course = Course(title='Test title', description='test description', access='Public', enrollCode='111', lockout='222', addedBy=self.user) self.course.save() self.courseunit = CourseUnit( unit=self.unit, course=self.course, order=0, addedBy=self.user, releaseTime=timezone.now() ) self.courseunit.save() self.lesson = Lesson(title='title', text='text', addedBy=self.user) self.lesson.save() self.unitlesson = UnitLesson( unit=self.unit, order=0, lesson=self.lesson, addedBy=self.user, treeID=self.lesson.id ) self.unitlesson.save() self.resp1 = Response( unitLesson=self.unitlesson, kind=Response.ORCT_RESPONSE, lesson=self.lesson, course=self.course, text="Some text user may respond", author=self.user, status=NEED_HELP_STATUS, selfeval=Response.DIFFERENT ) self.resp1.save() self.resp2 = Response( unitLesson=self.unitlesson, kind=Response.ORCT_RESPONSE, lesson=self.lesson, course=self.course, text="Some text user may be responded 2", author=self.user, status=NEED_HELP_STATUS, selfeval=Response.DIFFERENT ) self.resp2.save() self.default_data = {} self.client.login(username=self.username, password=self.password) self.url = reverse('ctms:course_settings', kwargs={'pk': self.course.id})