Verified Commit 04c63057 authored by Peter Stanko's avatar Peter Stanko
Browse files

Changed default permissions for the teacher

parent 0fce7c66
Loading
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ PERM_TEACHER = dict(
    view_course_full=True,
    update_course=True,
    handle_notes_access_token=False,
    write_roles=True,
    write_groups=True,
    write_projects=True,
    archive_projects=True,
@@ -42,7 +41,9 @@ PERM_TEACHER = dict(
    create_submissions=True,
    resubmit_submissions=True,
    evaluate_submissions=True,
    write_reviews_all=True
    write_reviews_all=True,
    read_submissions_groups=True,
    read_submissions_all=True
)

PERM_STUDENT = dict(
+13 −0
Original line number Diff line number Diff line
import pytest

from tests.rest.rest_tools import get_user_credentials


@pytest.fixture
def student_credentials() -> str:
    return get_user_credentials('student1')


@pytest.fixture
def teacher_credentials() -> str:
    return get_user_credentials('teacher2', '123123')
+0 −9
Original line number Diff line number Diff line
@@ -7,15 +7,6 @@ from tests.rest import rest_tools
from tests.rest.rest_tools import assert_response


@pytest.fixture
def student_credentials():
    return json.dumps({
        "type": "username_password",
        "identifier": "student1",
        "secret": "123456"
    })


@pytest.fixture
def worker_credentials():
    return json.dumps({
+0 −10
Original line number Diff line number Diff line
@@ -4,16 +4,6 @@ from tests.rest import rest_tools
from tests.rest.rest_tools import assert_response, get_user_credentials, get_user_secret


@pytest.fixture
def student_credentials() -> str:
    return get_user_credentials('student1')


@pytest.fixture
def teacher_credentials() -> str:
    return get_user_credentials('teacher2', '123123')


@pytest.fixture
def teacher_secret() -> str:
    return get_user_secret('teacher1', 'ultimate_teacher_secret')
+11 −2
Original line number Diff line number Diff line
@@ -84,14 +84,23 @@ def test_list_all_avail_for_group(rest_service, client):
# missing tests for working with zip
def test_read(client):
    submissions = Submission.query.all()
    s = submissions[0]
    response = rest_tools.make_request(client, f'/submissions/{s.id}', )
    submission = submissions[0]
    response = rest_tools.make_request(client, f'/submissions/{submission.id}', )
    assert_response(response, 200)

    submission = rest_tools.extract_data(response)
    rest_tools.assert_submission_in(submissions, submission)


def test_student_is_able_to_access_own_submission(client, rest_service, student_credentials):
    student = rest_service.find.user('student1')
    submission = student.submissions[0]
    response = rest_tools.make_request(client, f'/submissions/{submission.id}',
                                       credentials=student_credentials)

    assert_response(response, 200)


def test_delete(client):
    submissions = Submission.query.all()
    submissions_len = len(submissions)