Pass through room version to event auth

This commit is contained in:
Erik Johnston 2019-01-25 18:31:41 +00:00
parent b6dce9b9fd
commit ae2a957dba
10 changed files with 69 additions and 27 deletions

View file

@ -16,6 +16,7 @@
import unittest
from synapse import event_auth
from synapse.api.constants import RoomVersions
from synapse.api.errors import AuthError
from synapse.events import FrozenEvent
@ -35,12 +36,16 @@ class EventAuthTestCase(unittest.TestCase):
}
# creator should be able to send state
event_auth.check(_random_state_event(creator), auth_events, do_sig_check=False)
event_auth.check(
RoomVersions.V1, _random_state_event(creator), auth_events,
do_sig_check=False,
)
# joiner should not be able to send state
self.assertRaises(
AuthError,
event_auth.check,
RoomVersions.V1,
_random_state_event(joiner),
auth_events,
do_sig_check=False,
@ -69,13 +74,17 @@ class EventAuthTestCase(unittest.TestCase):
self.assertRaises(
AuthError,
event_auth.check,
RoomVersions.V1,
_random_state_event(pleb),
auth_events,
do_sig_check=False,
),
# king should be able to send state
event_auth.check(_random_state_event(king), auth_events, do_sig_check=False)
event_auth.check(
RoomVersions.V1, _random_state_event(king), auth_events,
do_sig_check=False,
)
# helpers for making events