Skip to content

Commit

Permalink
students: More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
worldbeater committed Apr 24, 2024
1 parent 8075d3b commit 969cd09
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ container:
migration:
cd webapp && alembic revision -m "$(TITLE)"

.DEFAULT_GOAL :=
.PHONY: coverage
coverage:
pytest --cov-report html --cov webapp ./tests

.DEFAULT_GOAL :=
6 changes: 6 additions & 0 deletions tests/ui/test_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ def test_no_reg_anonymous_submissions(db: AppDatabase, client: FlaskClient):

assert response.status_code == 200
assert code in html


@mode("exam")
def test_empty_submission_redirect(db: AppDatabase, client: FlaskClient):
response = client.get('/submissions')
assert response.status_code == 302
7 changes: 7 additions & 0 deletions tests/ui/test_teacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,10 @@ def test_anonymous_submission(db: AppDatabase, client: FlaskClient):
assert db.groups.get_by_id(gid).title in response.get_data(as_text=True)
assert code in response.get_data(as_text=True)
assert "студент" not in response.get_data(as_text=True)


def test_invalid_page_redirect(db: AppDatabase, client: FlaskClient):
teacher_login(db, client)
gid, vid, tid = arrange_task(db)
response = client.get(f"/teacher/submissions/group/{gid}/variant/{vid}/task/{tid}/1")
assert response.status_code == 302

0 comments on commit 969cd09

Please sign in to comment.