def i_am_registered_for_the_course(coursenum, metadata, user='******'): # Create user if user == 'BetaTester': # Create the course now = datetime.datetime.now(pytz.UTC) tomorrow = now + datetime.timedelta(days=5) metadata.update({'days_early_for_beta': 5, 'start': tomorrow}) create_course_for_lti(coursenum, metadata) course_descriptor = world.scenario_dict['COURSE'] course_location = world.scenario_dict['COURSE'].location # create beta tester user = BetaTesterFactory(course=course_location) normal_student = UserFactory() instructor = InstructorFactory(course=course_location) assert not has_access(normal_student, course_descriptor, 'load') assert has_access(user, course_descriptor, 'load') assert has_access(instructor, course_descriptor, 'load') else: metadata.update({'start': datetime.datetime(1970, 1, 1, tzinfo=UTC)}) create_course_for_lti(coursenum, metadata) course_descriptor = world.scenario_dict['COURSE'] course_location = world.scenario_dict['COURSE'].location user = InstructorFactory(course=course_location) # Enroll the user in the course and log them in if has_access(user, course_descriptor, 'load'): world.enroll_user(user, course_id(coursenum)) world.log_in(username=user.username, password='******')
def i_am_registered_for_the_course(course, metadata): # Create the course create_course(course, metadata) # Create an instructor instructor = InstructorFactory(course=world.scenario_dict['COURSE'].location) # Enroll the user in the course and log them in world.enroll_user(instructor, course_id(course)) world.log_in(username=instructor.username, password='******')
def i_am_registered_for_the_course(course, metadata): # Create the course create_course(course, metadata) # Create an instructor instructor = InstructorFactory( course=world.scenario_dict['COURSE'].location) # Enroll the user in the course and log them in world.enroll_user(instructor, course_id(course)) world.log_in(username=instructor.username, password='******')
def i_am_registered_for_the_course(course, metadata): # Create the course create_course(course, metadata) # Create the user world.create_user('robot', 'test') usr = User.objects.get(username='******') # If the user is not already enrolled, enroll the user. CourseEnrollment.enroll(usr, course_id(course)) world.log_in(username='******', password='******')
def create_user_and_visit_course(): world.create_user('robot', 'test') u = User.objects.get(username='******') CourseEnrollment.objects.get_or_create(user=u, course_id=course_id(world.scenario_dict['COURSE'].number)) world.log_in(username='******', password='******') chapter_name = (TEST_SECTION_NAME + "1").replace(" ", "_") section_name = (TEST_SUBSECTION_NAME + "1").replace(" ", "_") url = django_url('/courses/edx/model_course/Test_Course/courseware/%s/%s' % (chapter_name, section_name)) world.browser.visit(url)
def create_user_and_visit_course(): world.create_user('robot', 'test') u = User.objects.get(username='******') CourseEnrollment.enroll(u, course_id(world.scenario_dict['COURSE'].number)) world.log_in(username='******', password='******') chapter_name = (TEST_SECTION_NAME + "1").replace(" ", "_") section_name = (TEST_SUBSECTION_NAME + "1").replace(" ", "_") url = django_url('/courses/edx/model_course/Test_Course/courseware/%s/%s' % (chapter_name, section_name)) world.browser.visit(url)
def create_user_and_visit_course(): world.create_user('robot') u = User.objects.get(username='******') CourseEnrollment.objects.get_or_create(user=u, course_id=course_id("model_course")) world.log_in('robot', 'test') chapter_name = (TEST_SECTION_NAME + "1").replace(" ", "_") section_name = (TEST_SUBSECTION_NAME + "1").replace(" ", "_") url = django_url('/courses/edx/model_course/Test_Course/courseware/%s/%s' % (chapter_name, section_name)) world.browser.visit(url)
def i_am_staff_member_for_the_course(step, course_number): # Create the course create_course(step, course_number) course = get_course_by_id(course_id(course_number)) # Create the user world.create_user('robot', 'test') user = User.objects.get(username='******') # Add user as a course staff. allow_access(course, user, "staff") world.log_in(username='******', password='******')
def i_am_registered_for_the_course(course, metadata): # Create the course create_course(course, metadata) # Create the user world.create_user('robot', 'test') usr = User.objects.get(username='******') # If the user is not already enrolled, enroll the user. CourseEnrollment.enroll(usr, course_id(course)) world.add_to_course_staff('robot', world.scenario_dict['COURSE'].number) world.log_in(username='******', password='******')