##// 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 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 324 expected_extras = {'extra1': 'value1'}
323 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 327 assert isinstance(callback, hooks_daemon.DummyHooksCallbackDaemon)
326 328 expected_extras['hooks_module'] = 'rhodecode.lib.hooks_daemon'
327 329 assert extras == expected_extras
328 330
329 331 @pytest.mark.parametrize('protocol, expected_class', (
330 332 ('pyro4', hooks_daemon.Pyro4HooksCallbackDaemon),
331 ('Pyro4', hooks_daemon.Pyro4HooksCallbackDaemon),
332 ('HTTP', hooks_daemon.HttpHooksCallbackDaemon),
333 333 ('http', hooks_daemon.HttpHooksCallbackDaemon)
334 334 ))
335 335 def test_returns_real_hooks_callback_daemon_when_protocol_is_specified(
@@ -339,13 +339,30 b' class TestPrepareHooksDaemon(object):'
339 339 'hooks_protocol': protocol.lower()
340 340 }
341 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 343 assert isinstance(callback, expected_class)
344 344 hooks_uri = extras.pop('hooks_uri')
345 345 assert extras == expected_extras
346 346 if protocol.lower() == 'pyro4':
347 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 367 class MockRequest(object):
351 368 def __init__(self, request):
@@ -46,7 +46,7 b' def test_vcs_connections_have_a_timeout_'
46 46 with pytest.raises(TimeoutError):
47 47 # TODO: johbo: Find a better way to set this number
48 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 50 server.ping()
51 51 proxy_objects.append(server)
52 52
@@ -54,7 +54,7 b' def test_vcs_connections_have_a_timeout_'
54 54 def test_vcs_remote_calls_are_bound_by_timeout(pylonsapp, short_timeout):
55 55 server_and_port = pylonsapp.config['vcs.server']
56 56 with pytest.raises(TimeoutError):
57 server = create_vcsserver_proxy(server_and_port)
57 server = create_vcsserver_proxy(server_and_port, protocol='pyro4')
58 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