Esempio n. 1
0
def test_list_courses_student(client, auth, course):
    assert client.get('/courses/list').status_code == 302
    auth.login_student()
    assert client.get('/courses/list').status_code == 200
    response = client.get('/courses/list')
    assert b'Your Schedule' in response.data
    assert b'Math A' in response.data
Esempio n. 2
0
def test_fake_file_upload(client, auth):
    auth.login_student()
    response = client.post('assignments/1/upload',
                           content_type='multipart/form-data',
                           data={
                               'field': 'value',
                               'file': (BytesIO(b'FILE CONTENT'), '')
                           })
    assert response.status_code == 302
Esempio n. 3
0
def test_file_upload(client, auth):
    auth.login_student()
    client.post('assignments/1/upload',
                content_type='multipart/form-data',
                data={
                    'field': 'value',
                    'file': (BytesIO(b'FILE CONTENT'), './test.txt')
                })
    assert client.get('assignments/1/upload').status_code == 200
Esempio n. 4
0
def test_get_fake_assignment(client, auth):
    auth.login_student()
    assert client.get('assignments/9').status_code == 404
Esempio n. 5
0
def test_show_assignment_student(client, auth):
    auth.login_student()
    assert client.get('assignments/1').status_code == 200
    response = client.get('assignments/1')
    assert b'<h2>Math Homework</h2>' in response.data
Esempio n. 6
0
def test_edit_assignment_student(client, auth):
    auth.login_student()
    assert client.get('assignments/edit/1').status_code == 401
Esempio n. 7
0
def test_create_assignment_student(client, auth):
    assert client.get('/assignments/1/create').status_code == 302
    auth.login_student()
    assert client.get('/assignments/1/create').status_code == 401
Esempio n. 8
0
def test_file_upload_render_template(client, auth):
    auth.login_student()
    assert client.get('assignments/1/upload').status_code == 200
    assert client.get('assignments/1').status_code == 200
    response = client.get('assignments/1/upload')
    assert b'Upload New File' in response.data
Esempio n. 9
0
def test_grade_assignment_student(client, auth):
    auth.login_student()
    assert client.get('assignments/grade/1/2').status_code == 401
Esempio n. 10
0
def test_create_session_student(client, auth):
    assert client.get('/sessions/1/create').status_code == 302
    auth.login_student()
    assert client.get('/sessions/1/create').status_code == 401
Esempio n. 11
0
def test_show_course_student(client, auth):
    auth.login_student()
    assert client.get('courses/1/course').status_code == 200
    response = client.get('courses/1/course')
    assert b'<h1>1 Math</h1>' in response.data
Esempio n. 12
0
def test_edit_course_student(client, auth):
    auth.login_student()
    assert client.get('courses/1/edit').status_code == 401
Esempio n. 13
0
def test_create_course_student(client, auth):
    assert client.get('/courses/create').status_code == 302
    auth.login_student()
    assert client.get('/courses/create').status_code == 401