mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 03:23:54 +01:00
Move NullSource out of synapse and into tests since it is only used by the tests
This commit is contained in:
parent
7a5818ed81
commit
bb4dddd6c4
2 changed files with 17 additions and 17 deletions
|
@ -23,22 +23,6 @@ from synapse.handlers.typing import TypingNotificationEventSource
|
|||
from synapse.handlers.receipts import ReceiptEventSource
|
||||
|
||||
|
||||
class NullSource(object):
|
||||
"""This event source never yields any events and its token remains at
|
||||
zero. It may be useful for unit-testing."""
|
||||
def __init__(self, hs):
|
||||
pass
|
||||
|
||||
def get_new_events_for_user(self, user, from_key, limit):
|
||||
return defer.succeed(([], from_key))
|
||||
|
||||
def get_current_key(self, direction='f'):
|
||||
return defer.succeed(0)
|
||||
|
||||
def get_pagination_rows(self, user, pagination_config, key):
|
||||
return defer.succeed(([], pagination_config.from_key))
|
||||
|
||||
|
||||
class EventSources(object):
|
||||
SOURCE_TYPES = {
|
||||
"room": RoomEventSource,
|
||||
|
|
|
@ -41,6 +41,22 @@ myid = "@apple:test"
|
|||
PATH_PREFIX = "/_matrix/client/api/v1"
|
||||
|
||||
|
||||
class NullSource(object):
|
||||
"""This event source never yields any events and its token remains at
|
||||
zero. It may be useful for unit-testing."""
|
||||
def __init__(self, hs):
|
||||
pass
|
||||
|
||||
def get_new_events_for_user(self, user, from_key, limit):
|
||||
return defer.succeed(([], from_key))
|
||||
|
||||
def get_current_key(self, direction='f'):
|
||||
return defer.succeed(0)
|
||||
|
||||
def get_pagination_rows(self, user, pagination_config, key):
|
||||
return defer.succeed(([], pagination_config.from_key))
|
||||
|
||||
|
||||
class JustPresenceHandlers(object):
|
||||
def __init__(self, hs):
|
||||
self.presence_handler = PresenceHandler(hs)
|
||||
|
@ -243,7 +259,7 @@ class PresenceEventStreamTestCase(unittest.TestCase):
|
|||
# HIDEOUS HACKERY
|
||||
# TODO(paul): This should be injected in via the HomeServer DI system
|
||||
from synapse.streams.events import (
|
||||
PresenceEventSource, NullSource, EventSources
|
||||
PresenceEventSource, EventSources
|
||||
)
|
||||
|
||||
old_SOURCE_TYPES = EventSources.SOURCE_TYPES
|
||||
|
|
Loading…
Reference in a new issue