##// END OF EJS Templates
tests: Fix tests that depend on the default value of 'pyro4' as backend.
Martin Bornhold -
r968:70573703 default
parent child Browse files
Show More
@@ -318,18 +318,18 b' class TestHttpHooksCallbackDaemon(object'
318
318
319
319
320 class TestPrepareHooksDaemon(object):
320 class TestPrepareHooksDaemon(object):
321 def test_returns_dummy_hooks_callback_daemon_when_using_direct_calls(self):
321 @pytest.mark.parametrize('protocol', ('http', 'pyro4'))
322 def test_returns_dummy_hooks_callback_daemon_when_using_direct_calls(
323 self, protocol):
322 expected_extras = {'extra1': 'value1'}
324 expected_extras = {'extra1': 'value1'}
323 callback, extras = hooks_daemon.prepare_callback_daemon(
325 callback, extras = hooks_daemon.prepare_callback_daemon(
324 expected_extras.copy(), use_direct_calls=True)
326 expected_extras.copy(), protocol=protocol, use_direct_calls=True)
325 assert isinstance(callback, hooks_daemon.DummyHooksCallbackDaemon)
327 assert isinstance(callback, hooks_daemon.DummyHooksCallbackDaemon)
326 expected_extras['hooks_module'] = 'rhodecode.lib.hooks_daemon'
328 expected_extras['hooks_module'] = 'rhodecode.lib.hooks_daemon'
327 assert extras == expected_extras
329 assert extras == expected_extras
328
330
329 @pytest.mark.parametrize('protocol, expected_class', (
331 @pytest.mark.parametrize('protocol, expected_class', (
330 ('pyro4', hooks_daemon.Pyro4HooksCallbackDaemon),
332 ('pyro4', hooks_daemon.Pyro4HooksCallbackDaemon),
331 ('Pyro4', hooks_daemon.Pyro4HooksCallbackDaemon),
332 ('HTTP', hooks_daemon.HttpHooksCallbackDaemon),
333 ('http', hooks_daemon.HttpHooksCallbackDaemon)
333 ('http', hooks_daemon.HttpHooksCallbackDaemon)
334 ))
334 ))
335 def test_returns_real_hooks_callback_daemon_when_protocol_is_specified(
335 def test_returns_real_hooks_callback_daemon_when_protocol_is_specified(
@@ -339,13 +339,30 b' class TestPrepareHooksDaemon(object):'
339 'hooks_protocol': protocol.lower()
339 'hooks_protocol': protocol.lower()
340 }
340 }
341 callback, extras = hooks_daemon.prepare_callback_daemon(
341 callback, extras = hooks_daemon.prepare_callback_daemon(
342 expected_extras.copy(), protocol=protocol)
342 expected_extras.copy(), protocol=protocol, use_direct_calls=False)
343 assert isinstance(callback, expected_class)
343 assert isinstance(callback, expected_class)
344 hooks_uri = extras.pop('hooks_uri')
344 hooks_uri = extras.pop('hooks_uri')
345 assert extras == expected_extras
345 assert extras == expected_extras
346 if protocol.lower() == 'pyro4':
346 if protocol.lower() == 'pyro4':
347 assert hooks_uri.startswith('PYRO')
347 assert hooks_uri.startswith('PYRO')
348
348
349 @pytest.mark.parametrize('protocol', (
350 'invalid',
351 'Pyro4',
352 'Http',
353 'HTTP',
354 ))
355 def test_raises_on_invalid_protocol(self, protocol):
356 expected_extras = {
357 'extra1': 'value1',
358 'hooks_protocol': protocol.lower()
359 }
360 with pytest.raises(Exception):
361 callback, extras = hooks_daemon.prepare_callback_daemon(
362 expected_extras.copy(),
363 protocol=protocol,
364 use_direct_calls=False)
365
349
366
350 class MockRequest(object):
367 class MockRequest(object):
351 def __init__(self, request):
368 def __init__(self, request):
@@ -46,7 +46,7 b' def test_vcs_connections_have_a_timeout_'
46 with pytest.raises(TimeoutError):
46 with pytest.raises(TimeoutError):
47 # TODO: johbo: Find a better way to set this number
47 # TODO: johbo: Find a better way to set this number
48 for number in xrange(100):
48 for number in xrange(100):
49 server = create_vcsserver_proxy(server_and_port)
49 server = create_vcsserver_proxy(server_and_port, protocol='pyro4')
50 server.ping()
50 server.ping()
51 proxy_objects.append(server)
51 proxy_objects.append(server)
52
52
@@ -54,7 +54,7 b' def test_vcs_connections_have_a_timeout_'
54 def test_vcs_remote_calls_are_bound_by_timeout(pylonsapp, short_timeout):
54 def test_vcs_remote_calls_are_bound_by_timeout(pylonsapp, short_timeout):
55 server_and_port = pylonsapp.config['vcs.server']
55 server_and_port = pylonsapp.config['vcs.server']
56 with pytest.raises(TimeoutError):
56 with pytest.raises(TimeoutError):
57 server = create_vcsserver_proxy(server_and_port)
57 server = create_vcsserver_proxy(server_and_port, protocol='pyro4')
58 server.sleep(short_timeout + 1.0)
58 server.sleep(short_timeout + 1.0)
59
59
60
60
General Comments 0
You need to be logged in to leave comments. Login now