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
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
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
def test_get_fake_assignment(client, auth): auth.login_student() assert client.get('assignments/9').status_code == 404
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
def test_edit_assignment_student(client, auth): auth.login_student() assert client.get('assignments/edit/1').status_code == 401
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
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
def test_grade_assignment_student(client, auth): auth.login_student() assert client.get('assignments/grade/1/2').status_code == 401
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
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
def test_edit_course_student(client, auth): auth.login_student() assert client.get('courses/1/edit').status_code == 401
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