Skip to content
Snippets Groups Projects
Verified Commit a85d41c5 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix lint and tests

parent b6730fc4
No related branches found
No related tags found
1 merge request!7Resolve "Add periodic task for syncing rooms"
Pipeline #73269 passed with warnings
......@@ -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
......
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
......
......@@ -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
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment