mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 01:14:48 -04:00
Remove redundant get_success
calls in test code (#12346)
There are a bunch of places we call get_success on an immediate value, which is unnecessary. Let's rip them out, and remove the redundant functionality in get_success and friends.
This commit is contained in:
parent
c4cf916ed7
commit
33ebee47e4
13 changed files with 76 additions and 123 deletions
|
@ -87,24 +87,22 @@ class ModuleApiTestCase(HomeserverTestCase):
|
|||
self.assertEqual(displayname, "Bobberino")
|
||||
|
||||
def test_can_register_admin_user(self):
|
||||
user_id = self.get_success(
|
||||
self.register_user(
|
||||
"bob_module_admin", "1234", displayname="Bobberino Admin", admin=True
|
||||
)
|
||||
user_id = self.register_user(
|
||||
"bob_module_admin", "1234", displayname="Bobberino Admin", admin=True
|
||||
)
|
||||
|
||||
found_user = self.get_success(self.module_api.get_userinfo_by_id(user_id))
|
||||
self.assertEqual(found_user.user_id.to_string(), user_id)
|
||||
self.assertIdentical(found_user.is_admin, True)
|
||||
|
||||
def test_can_set_admin(self):
|
||||
user_id = self.get_success(
|
||||
self.register_user(
|
||||
"alice_wants_admin",
|
||||
"1234",
|
||||
displayname="Alice Powerhungry",
|
||||
admin=False,
|
||||
)
|
||||
user_id = self.register_user(
|
||||
"alice_wants_admin",
|
||||
"1234",
|
||||
displayname="Alice Powerhungry",
|
||||
admin=False,
|
||||
)
|
||||
|
||||
self.get_success(self.module_api.set_user_admin(user_id, True))
|
||||
found_user = self.get_success(self.module_api.get_userinfo_by_id(user_id))
|
||||
self.assertEqual(found_user.user_id.to_string(), user_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue