Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
1aaa4290
Commit
1aaa4290
authored
10 years ago
by
Paul "LeoNerd" Evans
Browse files
Options
Downloads
Patches
Plain Diff
Also unittest RoomMemberStore's joined_hosts_for_room()
parent
ae7dfeb5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/storage/test_roommember.py
+48
-0
48 additions, 0 deletions
tests/storage/test_roommember.py
with
48 additions
and
0 deletions
tests/storage/test_roommember.py
+
48
−
0
View file @
1aaa4290
...
...
@@ -43,6 +43,9 @@ class RoomMemberStoreTestCase(unittest.TestCase):
self
.
u_alice
=
hs
.
parse_userid
(
"
@alice:test
"
)
self
.
u_bob
=
hs
.
parse_userid
(
"
@bob:test
"
)
# User elsewhere on another host
self
.
u_charlie
=
hs
.
parse_userid
(
"
@charlie:elsewhere
"
)
self
.
room
=
hs
.
parse_roomid
(
"
!abc123:test
"
)
@defer.inlineCallbacks
...
...
@@ -107,3 +110,48 @@ class RoomMemberStoreTestCase(unittest.TestCase):
[
self
.
u_alice
.
to_string
(),
self
.
u_bob
.
to_string
()]
))
)
@defer.inlineCallbacks
def
test_room_hosts
(
self
):
yield
self
.
inject_room_member
(
self
.
room
,
self
.
u_alice
,
Membership
.
JOIN
)
self
.
assertEquals
(
[
"
test
"
],
(
yield
self
.
store
.
get_joined_hosts_for_room
(
self
.
room
.
to_string
()))
)
# Should still have just one host after second join from it
yield
self
.
inject_room_member
(
self
.
room
,
self
.
u_bob
,
Membership
.
JOIN
)
self
.
assertEquals
(
[
"
test
"
],
(
yield
self
.
store
.
get_joined_hosts_for_room
(
self
.
room
.
to_string
()))
)
# Should now have two hosts after join from other host
yield
self
.
inject_room_member
(
self
.
room
,
self
.
u_charlie
,
Membership
.
JOIN
)
self
.
assertEquals
(
{
"
test
"
,
"
elsewhere
"
},
set
((
yield
self
.
store
.
get_joined_hosts_for_room
(
self
.
room
.
to_string
())
))
)
# Should still have both hosts
yield
self
.
inject_room_member
(
self
.
room
,
self
.
u_alice
,
Membership
.
LEAVE
)
self
.
assertEquals
(
{
"
test
"
,
"
elsewhere
"
},
set
((
yield
self
.
store
.
get_joined_hosts_for_room
(
self
.
room
.
to_string
())
))
)
# Should have only one host after other leaves
yield
self
.
inject_room_member
(
self
.
room
,
self
.
u_charlie
,
Membership
.
LEAVE
)
self
.
assertEquals
(
[
"
test
"
],
(
yield
self
.
store
.
get_joined_hosts_for_room
(
self
.
room
.
to_string
()))
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment