mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 23:14:13 -04:00
Merge remote-tracking branch 'origin/develop' into HEAD
This commit is contained in:
commit
45c4e19c74
10 changed files with 45 additions and 11 deletions
|
@ -187,12 +187,32 @@ class RegistrationTestCase(unittest.TestCase):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def test_auto_create_auto_join_where_no_consent(self):
|
||||
self.hs.config.user_consent_at_registration = True
|
||||
self.hs.config.block_events_without_consent_error = "Error"
|
||||
"""Test to ensure that the first user is not auto-joined to a room if
|
||||
they have not given general consent.
|
||||
"""
|
||||
|
||||
# Given:-
|
||||
# * a user must give consent,
|
||||
# * they have not given that consent
|
||||
# * The server is configured to auto-join to a room
|
||||
# (and autocreate if necessary)
|
||||
|
||||
event_creation_handler = self.hs.get_event_creation_handler()
|
||||
# (Messing with the internals of event_creation_handler is fragile
|
||||
# but can't see a better way to do this. One option could be to subclass
|
||||
# the test with custom config.)
|
||||
event_creation_handler._block_events_without_consent_error = ("Error")
|
||||
event_creation_handler._consent_uri_builder = Mock()
|
||||
room_alias_str = "#room:test"
|
||||
self.hs.config.auto_join_rooms = [room_alias_str]
|
||||
|
||||
# When:-
|
||||
# * the user is registered and post consent actions are called
|
||||
res = yield self.handler.register(localpart='jeff')
|
||||
yield self.handler.post_consent_actions(res[0])
|
||||
|
||||
# Then:-
|
||||
# * Ensure that they have not been joined to the room
|
||||
rooms = yield self.store.get_rooms_for_user(res[0])
|
||||
self.assertEqual(len(rooms), 0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue