Show More
@@ -109,11 +109,11 b' def connect_http(server_and_port):' | |||||
109 | session_factory = client_http.ThreadlocalSessionFactory() |
|
109 | session_factory = client_http.ThreadlocalSessionFactory() | |
110 |
|
110 | |||
111 | connection.Git = client_http.RepoMaker( |
|
111 | connection.Git = client_http.RepoMaker( | |
112 | server_and_port, '/git', session_factory) |
|
112 | server_and_port, '/git', 'git', session_factory) | |
113 | connection.Hg = client_http.RepoMaker( |
|
113 | connection.Hg = client_http.RepoMaker( | |
114 | server_and_port, '/hg', session_factory) |
|
114 | server_and_port, '/hg', 'hg', session_factory) | |
115 | connection.Svn = client_http.RepoMaker( |
|
115 | connection.Svn = client_http.RepoMaker( | |
116 | server_and_port, '/svn', session_factory) |
|
116 | server_and_port, '/svn', 'svn', session_factory) | |
117 | connection.Service = client_http.ServiceConnection( |
|
117 | connection.Service = client_http.ServiceConnection( | |
118 | server_and_port, '/_service', session_factory) |
|
118 | server_and_port, '/_service', session_factory) | |
119 |
|
119 |
@@ -56,10 +56,11 b' EXCEPTIONS_MAP = {' | |||||
56 |
|
56 | |||
57 | class RepoMaker(object): |
|
57 | class RepoMaker(object): | |
58 |
|
58 | |||
59 | def __init__(self, server_and_port, backend_endpoint, session_factory): |
|
59 | def __init__(self, server_and_port, backend_endpoint, backend_type, session_factory): | |
60 | self.url = urlparse.urljoin( |
|
60 | self.url = urlparse.urljoin( | |
61 | 'http://%s' % server_and_port, backend_endpoint) |
|
61 | 'http://%s' % server_and_port, backend_endpoint) | |
62 | self._session_factory = session_factory |
|
62 | self._session_factory = session_factory | |
|
63 | self.backend_type = backend_type | |||
63 |
|
64 | |||
64 | def __call__(self, path, config, with_wire=None): |
|
65 | def __call__(self, path, config, with_wire=None): | |
65 | log.debug('RepoMaker call on %s', path) |
|
66 | log.debug('RepoMaker call on %s', path) | |
@@ -77,6 +78,7 b' class RepoMaker(object):' | |||||
77 | payload = { |
|
78 | payload = { | |
78 | 'id': str(uuid.uuid4()), |
|
79 | 'id': str(uuid.uuid4()), | |
79 | 'method': name, |
|
80 | 'method': name, | |
|
81 | 'backend': self.backend_type, | |||
80 | 'params': {'args': args, 'kwargs': kwargs} |
|
82 | 'params': {'args': args, 'kwargs': kwargs} | |
81 | } |
|
83 | } | |
82 | return _remote_call( |
|
84 | return _remote_call( |
@@ -70,7 +70,7 b' def stub_session_factory(stub_session):' | |||||
70 |
|
70 | |||
71 | def test_repo_maker_uses_session_for_classmethods(stub_session_factory): |
|
71 | def test_repo_maker_uses_session_for_classmethods(stub_session_factory): | |
72 | repo_maker = client_http.RepoMaker( |
|
72 | repo_maker = client_http.RepoMaker( | |
73 | 'server_and_port', 'endpoint', stub_session_factory) |
|
73 | 'server_and_port', 'endpoint', 'test_dummy_scm', stub_session_factory) | |
74 | repo_maker.example_call() |
|
74 | repo_maker.example_call() | |
75 | stub_session_factory().post.assert_called_with( |
|
75 | stub_session_factory().post.assert_called_with( | |
76 | 'http://server_and_port/endpoint', data=mock.ANY) |
|
76 | 'http://server_and_port/endpoint', data=mock.ANY) | |
@@ -79,7 +79,7 b' def test_repo_maker_uses_session_for_cla' | |||||
79 | def test_repo_maker_uses_session_for_instance_methods( |
|
79 | def test_repo_maker_uses_session_for_instance_methods( | |
80 | stub_session_factory, config): |
|
80 | stub_session_factory, config): | |
81 | repo_maker = client_http.RepoMaker( |
|
81 | repo_maker = client_http.RepoMaker( | |
82 | 'server_and_port', 'endpoint', stub_session_factory) |
|
82 | 'server_and_port', 'endpoint', 'test_dummy_scm', stub_session_factory) | |
83 | repo = repo_maker('stub_path', config) |
|
83 | repo = repo_maker('stub_path', config) | |
84 | repo.example_call() |
|
84 | repo.example_call() | |
85 | stub_session_factory().post.assert_called_with( |
|
85 | stub_session_factory().post.assert_called_with( |
General Comments 0
You need to be logged in to leave comments.
Login now