-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix test_auto_create_auto_join_where_no_consent #4886
Conversation
tests/handlers/test_register.py
Outdated
a sensible thing to test for, and (b) it doesn't work anyway because you can't | ||
change the config after the EventCreationHandler has been instantiated. | ||
"""Test to ensure that the first user is not auto-joined to a room if | ||
they have not given general consent. | ||
""" | ||
self.hs.config.user_consent_at_registration = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this and the next line actually do anything? I'd expect them to be redundant now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope
tests/handlers/test_register.py
Outdated
# * The server is configured to auto-join to a room | ||
# (and autocreate if necessary) | ||
event_creation_handler = self.hs.get_event_creation_handler() | ||
event_creation_handler._block_events_without_consent_error = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit dubious about this poking into the guts of EventCreationHandler
- it looks fragile. OTOH I can't really think of a better way of testing it, other than creating a new test class (possibly a subclass of RegistrationTestCase
) which uses a different config - which might be a bit fiddly right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this really mings - I'll comment explicitly to make it clearer
tests/handlers/test_register.py
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem to make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to make it clearer with formatting
Codecov Report
@@ Coverage Diff @@
## develop #4886 +/- ##
===========================================
- Coverage 77.87% 77.68% -0.19%
===========================================
Files 326 326
Lines 33949 34620 +671
Branches 5597 5811 +214
===========================================
+ Hits 26437 26896 +459
- Misses 5902 6068 +166
- Partials 1610 1656 +46 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rename the changelog to be a .misc
; it's not a user-facing bug
(lgtm other than the changelog) |
No description provided.