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
eef58a29
Commit
eef58a29
authored
10 years ago
by
Paul "LeoNerd" Evans
Browse files
Options
Downloads
Patches
Plain Diff
Don't mock out presence_handler's internal start/stop methods in presencelike unit test; it's rude
parent
fc778e2b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/handlers/test_presencelike.py
+5
-9
5 additions, 9 deletions
tests/handlers/test_presencelike.py
with
5 additions
and
9 deletions
tests/handlers/test_presencelike.py
+
5
−
9
View file @
eef58a29
...
...
@@ -63,6 +63,7 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
db_pool
=
None
,
datastore
=
Mock
(
spec
=
[
"
set_presence_state
"
,
"
is_presence_visible
"
,
"
set_profile_displayname
"
,
]),
...
...
@@ -83,6 +84,10 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
return
defer
.
succeed
(
"
Frank
"
)
self
.
datastore
.
get_profile_displayname
=
get_profile_displayname
def
is_presence_visible
(
*
args
,
**
kwargs
):
return
defer
.
succeed
(
False
)
self
.
datastore
.
is_presence_visible
=
is_presence_visible
def
get_profile_avatar_url
(
user_localpart
):
return
defer
.
succeed
(
"
http://foo
"
)
self
.
datastore
.
get_profile_avatar_url
=
get_profile_avatar_url
...
...
@@ -96,14 +101,9 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
self
.
handlers
=
hs
.
get_handlers
()
self
.
mock_start
=
Mock
()
self
.
mock_stop
=
Mock
()
self
.
mock_update_client
=
Mock
()
self
.
mock_update_client
.
return_value
=
defer
.
succeed
(
None
)
self
.
handlers
.
presence_handler
.
start_polling_presence
=
self
.
mock_start
self
.
handlers
.
presence_handler
.
stop_polling_presence
=
self
.
mock_stop
self
.
handlers
.
presence_handler
.
push_update_to_clients
=
(
self
.
mock_update_client
)
...
...
@@ -132,10 +132,6 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
mocked_set
.
assert_called_with
(
"
apple
"
,
{
"
state
"
:
UNAVAILABLE
,
"
status_msg
"
:
"
Away
"
})
self
.
mock_start
.
assert_called_with
(
self
.
u_apple
,
state
=
{
"
state
"
:
UNAVAILABLE
,
"
status_msg
"
:
"
Away
"
,
"
displayname
"
:
"
Frank
"
,
"
avatar_url
"
:
"
http://foo
"
})
@defer.inlineCallbacks
def
test_push_local
(
self
):
...
...
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