mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-14 11:30:49 +00:00
Fix test that assumes reactor time starts at 0
It no longer starts at 0 because we `self.reactor.advance(...)` waiting for the background updates to finish.
This commit is contained in:
@@ -1651,7 +1651,7 @@ class UserInfo:
|
||||
consent_server_notice_sent: Version of policy documents the user has been sent.
|
||||
consent_version: Version of policy documents the user has consented to.
|
||||
consent_ts: Time the user consented
|
||||
creation_ts: Creation timestamp of the user.
|
||||
creation_ts: Creation timestamp of the user (in seconds).
|
||||
is_admin: True if the user is an admin.
|
||||
is_deactivated: True if the user has been deactivated.
|
||||
is_guest: True if the user is a guest user.
|
||||
|
||||
@@ -85,6 +85,7 @@ class ModuleApiTestCase(BaseModuleApiTestCase):
|
||||
def test_can_register_user(self) -> None:
|
||||
"""Tests that an external module can register a user"""
|
||||
# Register a new user
|
||||
register_ts = int(self.clock.time_msec())
|
||||
user_id, access_token = self.get_success(
|
||||
self.module_api.register(
|
||||
"bob", displayname="Bobberino", emails=["bob@bobinator.bob"]
|
||||
@@ -105,8 +106,8 @@ class ModuleApiTestCase(BaseModuleApiTestCase):
|
||||
self.assertEqual(email.address, "bob@bobinator.bob")
|
||||
|
||||
# Should these be 0?
|
||||
self.assertEqual(email.validated_at, 0)
|
||||
self.assertEqual(email.added_at, 0)
|
||||
self.assertEqual(email.validated_at, register_ts)
|
||||
self.assertEqual(email.added_at, register_ts)
|
||||
|
||||
# Check that the displayname was assigned
|
||||
displayname = self.get_success(
|
||||
|
||||
@@ -39,6 +39,7 @@ class RegistrationStoreTestCase(HomeserverTestCase):
|
||||
self.device_id = "akgjhdjklgshg"
|
||||
|
||||
def test_register(self) -> None:
|
||||
register_ts_seconds = int(self.clock.time())
|
||||
self.get_success(self.store.register_user(self.user_id, self.pwhash))
|
||||
|
||||
self.assertEqual(
|
||||
@@ -50,7 +51,7 @@ class RegistrationStoreTestCase(HomeserverTestCase):
|
||||
consent_ts=None,
|
||||
consent_version=None,
|
||||
appservice_id=None,
|
||||
creation_ts=0,
|
||||
creation_ts=register_ts_seconds,
|
||||
user_type=None,
|
||||
is_deactivated=False,
|
||||
locked=False,
|
||||
|
||||
Reference in New Issue
Block a user