diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index be3240870..04d9d663f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -74,7 +74,7 @@ jobs: uses: ./.github/setup_python - name: Run MyPy - run: mypy -p evap + run: mypy linter: runs-on: ubuntu-22.04 @@ -89,7 +89,7 @@ jobs: uses: ./.github/setup_python - name: Run linter - run: pylint evap -j 0 + run: pylint evap tools formatter: diff --git a/evap/evaluation/management/commands/lint.py b/evap/evaluation/management/commands/lint.py index b7c4427ab..767637d61 100644 --- a/evap/evaluation/management/commands/lint.py +++ b/evap/evaluation/management/commands/lint.py @@ -9,4 +9,4 @@ class Command(BaseCommand): requires_migrations_checks = False def handle(self, *args, **options): - subprocess.run(["pylint", "evap"], check=False) # nosec + subprocess.run(["pylint", "evap", "tools"], check=False) # nosec diff --git a/evap/evaluation/management/commands/typecheck.py b/evap/evaluation/management/commands/typecheck.py index 080ad6b45..45a7670f1 100644 --- a/evap/evaluation/management/commands/typecheck.py +++ b/evap/evaluation/management/commands/typecheck.py @@ -9,4 +9,4 @@ class Command(BaseCommand): requires_migrations_checks = False def handle(self, *args, **options): - subprocess.run(["mypy", "-p", "evap"], check=True) # nosec + subprocess.run(["mypy"], check=True) # nosec diff --git a/evap/evaluation/tests/test_commands.py b/evap/evaluation/tests/test_commands.py index 1208b7005..85202a857 100644 --- a/evap/evaluation/tests/test_commands.py +++ b/evap/evaluation/tests/test_commands.py @@ -370,7 +370,7 @@ class TestLintCommand(TestCase): @patch("subprocess.run") def test_pylint_called(mock_subprocess_run): management.call_command("lint") - mock_subprocess_run.assert_called_once_with(["pylint", "evap"], check=False) + mock_subprocess_run.assert_called_once_with(["pylint", "evap", "tools"], check=False) class TestFormatCommand(TestCase): @@ -392,7 +392,7 @@ class TestTypecheckCommand(TestCase): def test_mypy_called(self, mock_subprocess_run): management.call_command("typecheck") self.assertEqual(len(mock_subprocess_run.mock_calls), 1) - mock_subprocess_run.assert_has_calls([call(["mypy", "-p", "evap"], check=True)]) + mock_subprocess_run.assert_has_calls([call(["mypy"], check=True)]) class TestPrecommitCommand(TestCase): diff --git a/evap/staff/fixtures/excel_files_test_data.py b/evap/staff/fixtures/excel_files_test_data.py index 64fbd90fc..71f33f9c1 100644 --- a/evap/staff/fixtures/excel_files_test_data.py +++ b/evap/staff/fixtures/excel_files_test_data.py @@ -1,4 +1,6 @@ +import csv import io +from typing import TextIO import openpyxl @@ -198,6 +200,14 @@ ] } +# user.title, user.last_name, user.first_name, user.email +valid_user_courses_import_users = [ + ['', 'Quid', 'Bastius', 'bastius.quid@external.example.com'], + ['', 'Sed', 'Diam', '345@external.institution.com'], + ['', 'Manilium', 'Lucilia', 'lucilia.manilium@student.institution.com'], + ['Prof. Dr.', 'Prorsus', 'Christoph', '123@external.com'] +] + random_file_content = b"Hallo Welt\n" @@ -221,3 +231,11 @@ def create_memory_excel_file(data): sheet.cell(row=row_num, column=column_num).value = cell_data workbook.save(memory_excel_file) return memory_excel_file.getvalue() + + +def create_memory_csv_file(data) -> TextIO: + memory_csv_file = io.StringIO() + writer = csv.writer(memory_csv_file, delimiter=";", lineterminator="\n") + writer.writerows(data) + memory_csv_file.seek(0) + return memory_csv_file diff --git a/evap/staff/templates/staff_index.html b/evap/staff/templates/staff_index.html index ac111241f..0ed2d8ccb 100644 --- a/evap/staff/templates/staff_index.html +++ b/evap/staff/templates/staff_index.html @@ -27,6 +27,7 @@