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

Changed default permissions for the teacher

parent 0fce7c66
Pipeline #17367 passed with stage
in 8 minutes and 18 seconds
......@@ -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(
......@@ -178,16 +179,16 @@ class DataFactory(object):
def scaffold_project(self, course: Course, name: str):
project_config = dict(
file_whitelist="*.*",
test_files_source='https://gitlab.fi.muni.cz/grp-kontr2/testing/hello-test-files',
test_files_subdir='',
pre_submit_script="python for kontr pre",
post_submit_script="python for kontr post",
submission_scheduler_config="python for sub Q",
submission_parameters="{\"type\":\"text\"}",
submissions_allowed_from=time.current_time() - timedelta(days=1),
submissions_allowed_to=time.current_time() + timedelta(days=10),
archive_from=time.current_time() + timedelta(days=30)
)
file_whitelist="*.*",
test_files_source='https://gitlab.fi.muni.cz/grp-kontr2/testing/hello-test-files',
test_files_subdir='',
pre_submit_script="python for kontr pre",
post_submit_script="python for kontr post",
submission_scheduler_config="python for sub Q",
submission_parameters="{\"type\":\"text\"}",
submissions_allowed_from=time.current_time() - timedelta(days=1),
submissions_allowed_to=time.current_time() + timedelta(days=10),
archive_from=time.current_time() + timedelta(days=30)
)
return self.create_project(
course=course, name=name, config=project_config)
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')
......@@ -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({
......
......@@ -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')
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment