Fix tests

This commit is contained in:
Erik Johnston 2016-01-25 13:12:35 +00:00
parent 42deca50c2
commit 8c6012a4af
2 changed files with 5 additions and 7 deletions

View File

@ -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("conntent", {}).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),

View File

@ -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):