def step_impl(context, course):
    c: Course = Course.select().where(Course.name == course).first()
    context.course_url = '%s/courses/%d' % (context.base_url, c.pk)
    context.browser.get(context.course_url)

    course_data = context.browser.find_element_by_class_name('lead')
    student_count = int(
        re.search(r'Student count: (\d+)', course_data.text)[1])
    capacity = int(re.search(r'Capacity: (\d+)', course_data.text)[1])

    assert student_count == capacity

    context.student_count = student_count
    context.capacity = capacity
예제 #2
0
def student_home():
    return render_template(
        'users/student_home.html.j2',
        courses=Course.select().join(CourseEnrollment).where(
            CourseEnrollment.student == session['current_user']['id']))