Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
8c6012a4
Commit
8c6012a4
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Fix tests
parent
42deca50
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/api/filtering.py
+1
-1
1 addition, 1 deletion
synapse/api/filtering.py
tests/api/test_filtering.py
+4
-6
4 additions, 6 deletions
tests/api/test_filtering.py
with
5 additions
and
7 deletions
synapse/api/filtering.py
+
1
−
1
View file @
8c6012a4
...
@@ -193,7 +193,7 @@ class Filter(object):
...
@@ -193,7 +193,7 @@ class Filter(object):
sender
=
event
.
get
(
"
sender
"
,
None
)
sender
=
event
.
get
(
"
sender
"
,
None
)
if
not
sender
:
if
not
sender
:
# Presence events have their 'sender' in content.user_id
# Presence events have their 'sender' in content.user_id
sender
=
event
.
get
(
"
con
n
tent
"
,
{}).
get
(
"
user_id
"
,
None
)
sender
=
event
.
get
(
"
content
"
,
{}).
get
(
"
user_id
"
,
None
)
return
self
.
check_fields
(
return
self
.
check_fields
(
event
.
get
(
"
room_id
"
,
None
),
event
.
get
(
"
room_id
"
,
None
),
...
...
This diff is collapsed.
Click to expand it.
tests/api/test_filtering.py
+
4
−
6
View file @
8c6012a4
...
@@ -13,26 +13,24 @@
...
@@ -13,26 +13,24 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
from
collections
import
namedtuple
from
tests
import
unittest
from
tests
import
unittest
from
twisted.internet
import
defer
from
twisted.internet
import
defer
from
mock
import
Mock
,
NonCallableMock
from
mock
import
Mock
from
tests.utils
import
(
from
tests.utils
import
(
MockHttpResource
,
DeferredMockCallable
,
setup_test_homeserver
MockHttpResource
,
DeferredMockCallable
,
setup_test_homeserver
)
)
from
synapse.types
import
UserID
from
synapse.types
import
UserID
from
synapse.api.filtering
import
FilterCollection
,
Filter
from
synapse.api.filtering
import
Filter
from
synapse.events
import
FrozenEvent
user_localpart
=
"
test_user
"
user_localpart
=
"
test_user
"
# MockEvent = namedtuple("MockEvent", "sender type room_id")
# MockEvent = namedtuple("MockEvent", "sender type room_id")
def
MockEvent
(
**
kwargs
):
def
MockEvent
(
**
kwargs
):
ev
=
NonCallableMock
(
spec_set
=
kwargs
.
keys
())
return
FrozenEvent
(
kwargs
)
ev
.
configure_mock
(
**
kwargs
)
return
ev
class
FilteringTestCase
(
unittest
.
TestCase
):
class
FilteringTestCase
(
unittest
.
TestCase
):
...
...
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