本文整理汇总了Python中tests.utils.setup_test_homeserver函数的典型用法代码示例。如果您正苦于以下问题:Python setup_test_homeserver函数的具体用法?Python setup_test_homeserver怎么用?Python setup_test_homeserver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup_test_homeserver函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.clock = MockClock()
self.mock_federation_resource = MockHttpResource()
self.mock_http_client = Mock(spec=[])
self.mock_http_client.put_json = DeferredMockCallable()
hs_kwargs = {}
if hasattr(self, "make_datastore_mock"):
hs_kwargs["datastore"] = self.make_datastore_mock()
hs = yield setup_test_homeserver(
clock=self.clock,
handlers=None,
resource_for_federation=self.mock_federation_resource,
http_client=self.mock_http_client,
keyring=Mock(),
**hs_kwargs
)
hs.handlers = JustPresenceHandlers(hs)
self.datastore = hs.get_datastore()
self.setUp_roommemberhandler_mocks(hs.handlers)
self.handler = hs.get_handlers().presence_handler
self.event_source = hs.get_event_sources().sources["presence"]
self.distributor = hs.get_distributor()
self.distributor.declare("user_joined_room")
yield self.setUp_users(hs)
开发者ID:roblabla,项目名称:synapse,代码行数:33,代码来源:test_presence.py
示例2: setUp
def setUp(self):
self.as_yaml_files = []
config = Mock(
app_service_config_files=self.as_yaml_files,
event_cache_size=1,
password_providers=[],
)
hs = yield setup_test_homeserver(
config=config,
federation_sender=Mock(),
federation_client=Mock(),
)
self.as_token = "token1"
self.as_url = "some_url"
self.as_id = "as1"
self._add_appservice(
self.as_token,
self.as_id,
self.as_url,
"some_hs_token",
"bob"
)
self._add_appservice("token2", "as2", "some_url", "some_hs_token", "bob")
self._add_appservice("token3", "as3", "some_url", "some_hs_token", "bob")
# must be done after inserts
self.store = ApplicationServiceStore(None, hs)
开发者ID:rubo77,项目名称:synapse,代码行数:27,代码来源:test_appservice.py
示例3: setUp
def setUp(self):
self.as_yaml_files = []
hs = yield setup_test_homeserver(
self.addCleanup, federation_sender=Mock(), federation_client=Mock()
)
hs.config.app_service_config_files = self.as_yaml_files
hs.config.event_cache_size = 1
hs.config.password_providers = []
self.db_pool = hs.get_db_pool()
self.engine = hs.database_engine
self.as_list = [
{"token": "token1", "url": "https://matrix-as.org", "id": "id_1"},
{"token": "alpha_tok", "url": "https://alpha.com", "id": "id_alpha"},
{"token": "beta_tok", "url": "https://beta.com", "id": "id_beta"},
{"token": "gamma_tok", "url": "https://gamma.com", "id": "id_gamma"},
]
for s in self.as_list:
yield self._add_service(s["url"], s["token"], s["id"])
self.as_yaml_files = []
self.store = TestTransactionStore(hs.get_db_conn(), hs)
开发者ID:matrix-org,项目名称:synapse,代码行数:26,代码来源:test_appservice.py
示例4: setUp
def setUp(self):
hs = yield setup_test_homeserver()
self.store = DirectoryStore(hs)
self.room = RoomID.from_string("!abcde:test")
self.alias = RoomAlias.from_string("#my-room:test")
开发者ID:0-T-0,项目名称:synapse,代码行数:7,代码来源:test_directory.py
示例5: setUp
def setUp(self):
self.hs = yield setup_test_homeserver(self.addCleanup)
self.event_creation_handler = self.hs.get_event_creation_handler()
self.event_builder_factory = self.hs.get_event_builder_factory()
self.store = self.hs.get_datastore()
yield create_room(self.hs, TEST_ROOM_ID, "@someone:ROOM")
开发者ID:DoubleMalt,项目名称:synapse,代码行数:7,代码来源:test_visibility.py
示例6: setUp
def setUp(self):
hs = yield setup_test_homeserver(self.addCleanup)
self.store = hs.get_datastore()
self.room = RoomID.from_string("!abcde:test")
self.alias = RoomAlias.from_string("#my-room:test")
开发者ID:DoubleMalt,项目名称:synapse,代码行数:7,代码来源:test_directory.py
示例7: setUp
def setUp(self):
hs = yield setup_test_homeserver(clock=MockClock())
self.store = PresenceStore(hs)
self.u_apple = UserID.from_string("@apple:test")
self.u_banana = UserID.from_string("@banana:test")
开发者ID:Vutsuak16,项目名称:synapse,代码行数:7,代码来源:test_presence.py
示例8: setUp
def setUp(self):
self.hs = yield setup_test_homeserver(
"blue",
http_client=None,
federation_client=Mock(),
ratelimiter=NonCallableMock(spec_set=[
"send_message",
]),
)
self.hs.get_ratelimiter().send_message.return_value = (True, 0)
self.master_store = self.hs.get_datastore()
self.slaved_store = self.STORE_TYPE(self.hs.get_db_conn(), self.hs)
self.event_id = 0
server_factory = ReplicationStreamProtocolFactory(self.hs)
# XXX: mktemp is unsafe and should never be used. but we're just a test.
path = tempfile.mktemp(prefix="base_slaved_store_test_case_socket")
listener = reactor.listenUNIX(path, server_factory)
self.addCleanup(listener.stopListening)
self.streamer = server_factory.streamer
self.replication_handler = ReplicationClientHandler(self.slaved_store)
client_factory = ReplicationClientFactory(
self.hs, "client_name", self.replication_handler
)
client_connector = reactor.connectUNIX(path, client_factory)
self.addCleanup(client_factory.stopTrying)
self.addCleanup(client_connector.disconnect)
开发者ID:rubo77,项目名称:synapse,代码行数:29,代码来源:_base.py
示例9: setUp
def setUp(self):
self.hs = yield setup_test_homeserver()
self.store = UserDirectoryStore(None, self.hs)
# alice and bob are both in !room_id. bobby is not but shares
# a homeserver with alice.
yield self.store.add_profiles_to_user_dir(
"!room:id",
{
ALICE: ProfileInfo(None, "alice"),
BOB: ProfileInfo(None, "bob"),
BOBBY: ProfileInfo(None, "bobby")
},
)
yield self.store.add_users_to_public_room(
"!room:id",
[ALICE, BOB],
)
yield self.store.add_users_who_share_room(
"!room:id",
False,
(
(ALICE, BOB),
(BOB, ALICE),
),
)
开发者ID:rubo77,项目名称:synapse,代码行数:26,代码来源:test_user_directory.py
示例10: setUp
def setUp(self):
self.mock_federation = Mock()
self.mock_registry = Mock()
self.query_handlers = {}
def register_query_handler(query_type, handler):
self.query_handlers[query_type] = handler
self.mock_registry.register_query_handler = register_query_handler
hs = yield setup_test_homeserver(
self.addCleanup,
http_client=None,
handlers=None,
resource_for_federation=Mock(),
federation_client=self.mock_federation,
federation_server=Mock(),
federation_registry=self.mock_registry,
ratelimiter=NonCallableMock(spec_set=["can_do_action"]),
)
self.ratelimiter = hs.get_ratelimiter()
self.ratelimiter.can_do_action.return_value = (True, 0)
self.store = hs.get_datastore()
self.frank = UserID.from_string("@1234ABCD:test")
self.bob = UserID.from_string("@4567:test")
self.alice = UserID.from_string("@alice:remote")
yield self.store.create_profile(self.frank.localpart)
self.handler = hs.get_profile_handler()
开发者ID:matrix-org,项目名称:synapse,代码行数:34,代码来源:test_profile.py
示例11: test_unique_works
def test_unique_works(self):
f1 = self._write_config(suffix="1")
f2 = self._write_config(suffix="2")
config = Mock(app_service_config_files=[f1, f2], event_cache_size=1)
hs = yield setup_test_homeserver(config=config, datastore=Mock())
ApplicationServiceStore(hs)
开发者ID:MorganBauer,项目名称:synapse,代码行数:8,代码来源:test_appservice.py
示例12: setUp
def setUp(self):
self.mock_perspective_server = MockPerspectiveServer()
self.http_client = Mock()
self.hs = yield utils.setup_test_homeserver(
self.addCleanup, handlers=None, http_client=self.http_client
)
keys = self.mock_perspective_server.get_verify_keys()
self.hs.config.perspectives = {self.mock_perspective_server.server_name: keys}
开发者ID:gergelypolonkai,项目名称:synapse,代码行数:8,代码来源:test_keyring.py
示例13: setUp
def setUp(self):
self.hs = yield utils.setup_test_homeserver(
self.addCleanup,
handlers=None,
replication_layer=mock.Mock(),
)
self.handler = synapse.handlers.e2e_room_keys.E2eRoomKeysHandler(self.hs)
self.local_user = "@boris:" + self.hs.hostname
开发者ID:DoubleMalt,项目名称:synapse,代码行数:8,代码来源:test_e2e_room_keys.py
示例14: setUp
def setUp(self):
self.hs = yield setup_test_homeserver(
resource_for_federation=Mock(),
http_client=None,
)
self.store = self.hs.get_datastore()
self.db_pool = self.hs.get_db_pool()
self.message_handler = self.hs.get_handlers().message_handler
self.event_injector = EventInjector(self.hs)
开发者ID:Vutsuak16,项目名称:synapse,代码行数:9,代码来源:test_events.py
示例15: setUp
def setUp(self):
hs = yield setup_test_homeserver()
self.store = RegistrationStore(hs)
self.user_id = "@my-user:test"
self.tokens = ["AbCdEfGhIjKlMnOpQrStUvWxYz",
"BcDeFgHiJkLmNoPqRsTuVwXyZa"]
self.pwhash = "{xx1}123456789"
开发者ID:heavenlyhash,项目名称:synapse,代码行数:9,代码来源:test_registration.py
示例16: setUp
def setUp(self):
self.hs = yield setup_test_homeserver(
"red", http_client=None, replication_layer=Mock(), ratelimiter=NonCallableMock(spec_set=["send_message"])
)
self.user_id = "@seeing:red"
self.user = UserID.from_string(self.user_id)
self.hs.get_ratelimiter().send_message.return_value = (True, 0)
self.resource = ReplicationResource(self.hs)
开发者ID:OlegGirko,项目名称:synapse,代码行数:10,代码来源:test_resource.py
示例17: setUp
def setUp(self):
hs = yield setup_test_homeserver(self.addCleanup)
self.db_pool = hs.get_db_pool()
self.store = hs.get_datastore()
self.user_id = "@my-user:test"
self.tokens = ["AbCdEfGhIjKlMnOpQrStUvWxYz", "BcDeFgHiJkLmNoPqRsTuVwXyZa"]
self.pwhash = "{xx1}123456789"
self.device_id = "akgjhdjklgshg"
开发者ID:matrix-org,项目名称:synapse,代码行数:10,代码来源:test_registration.py
示例18: setUp
def setUp(self):
self.hs = yield setup_test_homeserver(self.addCleanup)
self.store = UserDirectoryStore(self.hs.get_db_conn(), self.hs)
# alice and bob are both in !room_id. bobby is not but shares
# a homeserver with alice.
yield self.store.update_profile_in_user_dir(ALICE, "alice", None)
yield self.store.update_profile_in_user_dir(BOB, "bob", None)
yield self.store.update_profile_in_user_dir(BOBBY, "bobby", None)
yield self.store.add_users_in_public_rooms("!room:id", (ALICE, BOB))
开发者ID:matrix-org,项目名称:synapse,代码行数:10,代码来源:test_user_directory.py
示例19: setUp
def setUp(self):
hs = yield setup_test_homeserver()
self.store = hs.get_datastore()
self.clock = hs.get_clock()
self.update_handler = Mock()
yield self.store.register_background_update_handler(
"test_update", self.update_handler
)
开发者ID:Vutsuak16,项目名称:synapse,代码行数:10,代码来源:test_background_update.py
示例20: setUp
def setUp(self):
self.state_handler = Mock()
self.store = Mock()
self.hs = yield setup_test_homeserver(handlers=None)
self.hs.get_datastore = Mock(return_value=self.store)
self.auth = Auth(self.hs)
self.test_user = "@foo:bar"
self.test_token = "_test_token_"
开发者ID:mebjas,项目名称:synapse,代码行数:10,代码来源:test_auth.py
注:本文中的tests.utils.setup_test_homeserver函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论