# HG changeset patch # User RhodeCode Admin # Date 2023-02-01 12:29:39 # Node ID d7efefeb242c5433d52c69b97c22fc01d1d1dc84 # Parent d49e3bd84c1f956020962c27fd4d30459c075875 hooks: fixed tests diff --git a/rhodecode/tests/lib/test_hooks_daemon.py b/rhodecode/tests/lib/test_hooks_daemon.py --- a/rhodecode/tests/lib/test_hooks_daemon.py +++ b/rhodecode/tests/lib/test_hooks_daemon.py @@ -128,8 +128,7 @@ class TestHooksHttpHandler(object): with date_patcher, caplog.at_level(logging.DEBUG): handler.log_message('Some message %d, %s', 123, 'string') - expected_message = '{} - - [{}] Some message 123, string'.format( - ip_port[0], fake_date) + expected_message = "HOOKS: {} - - [{}] Some message 123, string".format(ip_port, fake_date) assert_message_in_log( caplog.records, expected_message, levelno=logging.DEBUG, module='hooks_daemon') @@ -192,8 +191,8 @@ class TestHttpHooksCallbackDaemon(object _, port = tcp_server.server_address expected_uri = '{}:{}'.format('127.0.0.1', port) - msg = 'Preparing HTTP callback daemon at `{}` and ' \ - 'registering hook object: rhodecode.lib.hooks_daemon.HooksHttpHandler'.format(expected_uri) + msg = 'HOOKS: {} Preparing HTTP callback daemon registering ' \ + 'hook object: rhodecode.lib.hooks_daemon.HooksHttpHandler'.format(expected_uri) assert_message_in_log( caplog.records, msg, levelno=logging.DEBUG, module='hooks_daemon') @@ -206,8 +205,8 @@ class TestHttpHooksCallbackDaemon(object expected_uri = '{}:{}'.format('127.0.0.1', port) assert daemon.hooks_uri == expected_uri - msg = 'Preparing HTTP callback daemon at `{}` and ' \ - 'registering hook object: rhodecode.lib.hooks_daemon.HooksHttpHandler'.format(expected_uri) + msg = 'HOOKS: {} Preparing HTTP callback daemon registering ' \ + 'hook object: rhodecode.lib.hooks_daemon.HooksHttpHandler'.format(expected_uri) assert_message_in_log( caplog.records, msg, levelno=logging.DEBUG, module='hooks_daemon') @@ -329,10 +328,11 @@ class MockRequest(object): class MockServer(object): - def __init__(self, Handler, request): + def __init__(self, handler_cls, request): ip_port = ('0.0.0.0', 8888) self.request = MockRequest(request) - self.handler = Handler(self.request, ip_port, self) + self.server_address = ip_port + self.handler = handler_cls(self.request, ip_port, self) @pytest.fixture()