From a85d41c55783194afb36b3325ec1ce9d2759b4b4 Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Tue, 7 Jun 2022 22:36:36 +0200 Subject: [PATCH] Fix lint and tests --- aleksis/apps/matrix/model_extensions.py | 1 + aleksis/apps/matrix/tasks.py | 2 -- .../apps/matrix/tests/synapse/homeserver.yaml | 4 ++- aleksis/apps/matrix/tests/test_matrix.py | 25 ------------------- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/aleksis/apps/matrix/model_extensions.py b/aleksis/apps/matrix/model_extensions.py index 205ee40..4e0472b 100644 --- a/aleksis/apps/matrix/model_extensions.py +++ b/aleksis/apps/matrix/model_extensions.py @@ -22,6 +22,7 @@ def provision_in_matrix(self, sync: bool = False) -> Union[MatrixRoom, AsyncResu def _provision_in_matrix(self) -> MatrixRoom: """Create and sync a room for this group in Matrix.""" room = MatrixRoom.from_group(self) + room.sync() return room diff --git a/aleksis/apps/matrix/tasks.py b/aleksis/apps/matrix/tasks.py index 8574b3a..34ccd15 100644 --- a/aleksis/apps/matrix/tasks.py +++ b/aleksis/apps/matrix/tasks.py @@ -1,8 +1,6 @@ from datetime import timedelta from typing import Sequence -from celery.task.sets import TaskSet - from aleksis.apps.matrix.models import MatrixRoom from aleksis.core.celery import app from aleksis.core.models import Group diff --git a/aleksis/apps/matrix/tests/synapse/homeserver.yaml b/aleksis/apps/matrix/tests/synapse/homeserver.yaml index 05da9c0..9221c00 100644 --- a/aleksis/apps/matrix/tests/synapse/homeserver.yaml +++ b/aleksis/apps/matrix/tests/synapse/homeserver.yaml @@ -30,4 +30,6 @@ form_secret: "eYJgrzzEXHsgblxAi3pBmPsNrXrga.OVTKkmb&u64A11V_8axr" signing_key_path: "%path%/synapse/matrix.aleksis.example.org.signing.key" trusted_key_servers: - - server_name: "matrix.org" \ No newline at end of file + - server_name: "matrix.org" + +enable_registration_without_verification: true diff --git a/aleksis/apps/matrix/tests/test_matrix.py b/aleksis/apps/matrix/tests/test_matrix.py index 7d15ae6..b1cc47d 100644 --- a/aleksis/apps/matrix/tests/test_matrix.py +++ b/aleksis/apps/matrix/tests/test_matrix.py @@ -320,31 +320,6 @@ def test_use_room_sync(matrix_bot_user): from django.test import TransactionTestCase, override_settings -@pytest.mark.usefixtures("celery_worker", "matrix_bot_user") -@override_settings(CELERY_BROKER_URL="memory://localhost//") -@override_settings(HAYSTACK_SIGNAL_PROCESSOR="") -class MatrixCeleryTest(TransactionTestCase): - serialized_rollback = True - - def test_use_room_async(self): - get_site_preferences()["matrix__homeserver_ids"] = "matrix.aleksis.example.org" - - g = Group.objects.create(name="Test Room") - u1 = User.objects.create_user("test1", "test1@example.org", "test1") - - p1 = Person.objects.create(first_name="Test", last_name="Person", user=u1) - - g.members.add(p1) - - r = g.provision_in_matrix(sync=False) - assert isinstance(r, AsyncResult) - - time.sleep(3) - - assert MatrixProfile.objects.all().count() == 1 - assert p1.matrix_profile - assert p1.matrix_profile.matrix_id == "@test1:matrix.aleksis.example.org" - def test_space_creation(matrix_bot_user): parent_group = Group.objects.create(name="Test Group") -- GitLab