本文整理汇总了Python中staxing.helper.Teacher.rotate_calendar方法的典型用法代码示例。如果您正苦于以下问题:Python Teacher.rotate_calendar方法的具体用法?Python Teacher.rotate_calendar怎么用?Python Teacher.rotate_calendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类staxing.helper.Teacher
的用法示例。
在下文中一共展示了Teacher.rotate_calendar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestStaxingTutorTeacher
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import rotate_calendar [as 别名]
class TestStaxingTutorTeacher(unittest.TestCase):
"""Staxing case tests."""
def setUp(self):
"""Pretest settings."""
self.teacher = Teacher(use_env_vars=True)
self.teacher.username = os.getenv('TEACHER_USER_MULTI',
self.teacher.username)
self.teacher.set_window_size(height=700, width=1200)
self.teacher.login()
self.teacher.select_course(title='High School Physics')
def tearDown(self):
"""Test destructor."""
try:
self.teacher.driver.quit()
except:
pass
@pytest.mark.skipif(str(301) not in TESTS, reason='Excluded')
def test_add_reading_assignment_individual_publish(self):
"""Build reading assignments."""
# Reading, individual periods, publish
assignment_title = 'Reading-%s' % Assignment.rword(5)
left = randint(5, 20)
right = left + randint(1, 10)
start_date_1 = self.teacher.date_string(day_delta=left)
end_date_1 = self.teacher.date_string(day_delta=left + right)
start_date_2 = self.teacher.date_string(day_delta=left + 1)
end_date_2 = self.teacher.date_string(day_delta=left + right + 1)
start_time_2 = '6:30 am'
end_time_2 = '11:59 pm'
start_date_3 = self.teacher.date_string(day_delta=left + 2)
end_date_3 = self.teacher.date_string(day_delta=left + right + 2)
reading_options = self.teacher.get_book_sections()
reading_start = randint(0, (len(reading_options) - 1))
reading_end = reading_start + randint(1, 5)
reading_list = reading_options[reading_start:reading_end]
self.teacher.add_assignment(
assignment='reading',
args={
'title': assignment_title,
'description': 'Staxing test reading - individual periods - ' +
'publish',
'periods': {
'First': (start_date_1, end_date_1),
'Second': ((start_date_2, start_time_2),
(end_date_2, end_time_2)),
'Third': (start_date_3, end_date_3),
},
'reading_list': reading_list,
'status': 'publish',
'break_point': None,
}
)
assert('courses' in self.teacher.current_url()), \
'Not at dashboard'
self.teacher.rotate_calendar(end_date_1)
reading = self.teacher.find(
By.XPATH,
'//label[text()="%s"]' % assignment_title
)
time.sleep(5.0)
assert(reading), '%s not publishing on %s' % (assignment_title,
end_date_3)
@pytest.mark.skipif(str(302) not in TESTS, reason='Excluded')
def test_add_reading_assignment_all_publish(self):
"""Build reading assignments."""
# Reading, all periods, publish
assignment_title = 'Reading-%s' % Assignment.rword(5)
left = randint(5, 20)
right = left + randint(1, 10)
start_date_1 = self.teacher.date_string(day_delta=left)
end_date_1 = self.teacher.date_string(day_delta=left + right)
start_date_2 = self.teacher.date_string(day_delta=left + 1)
end_date_2 = self.teacher.date_string(day_delta=left + right + 1)
reading_options = self.teacher.get_book_sections()
reading_start = randint(0, (len(reading_options) - 1))
reading_end = reading_start + randint(1, 5)
reading_list = reading_options[reading_start:reading_end]
self.teacher.add_assignment(
assignment='reading',
args={
'title': assignment_title,
'description': 'Staxing test reading - all periods - publish',
'periods': {
'First': (start_date_1, end_date_1),
'all': (start_date_2, end_date_2),
},
'reading_list': reading_list,
'status': 'publish',
'break_point': None,
}
)
assert('courses' in self.teacher.current_url()), \
'Not at dashboard'
self.teacher.rotate_calendar(end_date_1)
reading = self.teacher.find(
By.XPATH,
#.........这里部分代码省略.........