Show More
@@ -77,7 +77,7 b' class SimpleGit(simplevcs.SimpleVCS):' | |||
|
77 | 77 | |
|
78 | 78 | def _create_wsgi_app(self, repo_path, repo_name, config): |
|
79 | 79 | return self.scm_app.create_git_wsgi_app( |
|
80 |
repo_path, repo_name, config |
|
|
80 | repo_path, repo_name, config) | |
|
81 | 81 | |
|
82 | 82 | def _create_config(self, extras, repo_name): |
|
83 | 83 | extras['git_update_server_info'] = utils2.str2bool( |
@@ -72,7 +72,7 b' class SimpleHg(simplevcs.SimpleVCS):' | |||
|
72 | 72 | |
|
73 | 73 | def _create_wsgi_app(self, repo_path, repo_name, config): |
|
74 | 74 | return self.scm_app.create_hg_wsgi_app( |
|
75 |
repo_path, repo_name, config |
|
|
75 | repo_path, repo_name, config) | |
|
76 | 76 | |
|
77 | 77 | def _create_config(self, extras, repo_name): |
|
78 | 78 | config = utils.make_db_config(repo=repo_name) |
@@ -34,7 +34,7 b' HG_REMOTE_WSGI = None' | |||
|
34 | 34 | GIT_REMOTE_WSGI = None |
|
35 | 35 | |
|
36 | 36 | |
|
37 |
def create_git_wsgi_app(repo_path, repo_name, config |
|
|
37 | def create_git_wsgi_app(repo_path, repo_name, config): | |
|
38 | 38 | """ |
|
39 | 39 | Return a WSGI app backed by a remote app to handle Git. |
|
40 | 40 | |
@@ -45,10 +45,10 b' def create_git_wsgi_app(repo_path, repo_' | |||
|
45 | 45 | log.error('Pyro server has not been initialized yet') |
|
46 | 46 | |
|
47 | 47 | return wsgi_app_caller_client.RemoteAppCaller( |
|
48 |
factory |
|
|
48 | factory, repo_path, repo_name, config) | |
|
49 | 49 | |
|
50 | 50 | |
|
51 |
def create_hg_wsgi_app(repo_path, repo_name, config |
|
|
51 | def create_hg_wsgi_app(repo_path, repo_name, config): | |
|
52 | 52 | """ |
|
53 | 53 | Return a WSGI app backed by a remote app to handle Mercurial. |
|
54 | 54 | |
@@ -60,4 +60,4 b' def create_hg_wsgi_app(repo_path, repo_n' | |||
|
60 | 60 | log.error('Pyro server has not been initialized yet') |
|
61 | 61 | |
|
62 | 62 | return wsgi_app_caller_client.RemoteAppCaller( |
|
63 |
factory |
|
|
63 | factory, repo_path, repo_name, config) |
@@ -37,14 +37,14 b' import rhodecode' | |||
|
37 | 37 | log = logging.getLogger(__name__) |
|
38 | 38 | |
|
39 | 39 | |
|
40 |
def create_git_wsgi_app(repo_path, repo_name, config |
|
|
40 | def create_git_wsgi_app(repo_path, repo_name, config): | |
|
41 | 41 | url = _vcs_streaming_url() + 'git/' |
|
42 |
return VcsHttpProxy(url, repo_path, repo_name, config |
|
|
42 | return VcsHttpProxy(url, repo_path, repo_name, config) | |
|
43 | 43 | |
|
44 | 44 | |
|
45 |
def create_hg_wsgi_app(repo_path, repo_name, config |
|
|
45 | def create_hg_wsgi_app(repo_path, repo_name, config): | |
|
46 | 46 | url = _vcs_streaming_url() + 'hg/' |
|
47 |
return VcsHttpProxy(url, repo_path, repo_name, config |
|
|
47 | return VcsHttpProxy(url, repo_path, repo_name, config) | |
|
48 | 48 | |
|
49 | 49 | |
|
50 | 50 | def _vcs_streaming_url(): |
@@ -67,7 +67,7 b' class VcsHttpProxy(object):' | |||
|
67 | 67 | server as well. |
|
68 | 68 | """ |
|
69 | 69 | |
|
70 |
def __init__(self, url, repo_path, repo_name, config |
|
|
70 | def __init__(self, url, repo_path, repo_name, config): | |
|
71 | 71 | """ |
|
72 | 72 | :param str url: The URL of the VCSServer to call. |
|
73 | 73 | """ |
@@ -75,7 +75,6 b' class VcsHttpProxy(object):' | |||
|
75 | 75 | self._repo_name = repo_name |
|
76 | 76 | self._repo_path = repo_path |
|
77 | 77 | self._config = config |
|
78 | self._backend = backend | |
|
79 | 78 | log.debug( |
|
80 | 79 | "Creating VcsHttpProxy for repo %s, url %s", |
|
81 | 80 | repo_name, url) |
@@ -56,18 +56,16 b' class RemoteAppCaller(object):' | |||
|
56 | 56 | It first cleans the environment, so as to reduce the data transferred. |
|
57 | 57 | """ |
|
58 | 58 | |
|
59 |
def __init__(self, remote_wsgi, |
|
|
59 | def __init__(self, remote_wsgi, *args, **kwargs): | |
|
60 | 60 | """ |
|
61 | 61 | :param remote_wsgi: The remote wsgi object that creates a |
|
62 | 62 | WSGIAppCaller. This object |
|
63 | 63 | has to have a handle method, with the signature: |
|
64 | 64 | handle(environ, start_response, *args, **kwargs) |
|
65 | :param backend: Key (str) of the SCM backend that is in use. | |
|
66 | 65 | :param args: args to be passed to the app creation |
|
67 | 66 | :param kwargs: kwargs to be passed to the app creation |
|
68 | 67 | """ |
|
69 | 68 | self._remote_wsgi = remote_wsgi |
|
70 | self._backend = backend | |
|
71 | 69 | self._args = args |
|
72 | 70 | self._kwargs = kwargs |
|
73 | 71 |
@@ -27,11 +27,11 b' for testing purposes.' | |||
|
27 | 27 | import mock |
|
28 | 28 | |
|
29 | 29 | |
|
30 |
def create_git_wsgi_app(repo_path, repo_name, config |
|
|
30 | def create_git_wsgi_app(repo_path, repo_name, config): | |
|
31 | 31 | return mock_git_wsgi |
|
32 | 32 | |
|
33 | 33 | |
|
34 |
def create_hg_wsgi_app(repo_path, repo_name, config |
|
|
34 | def create_hg_wsgi_app(repo_path, repo_name, config): | |
|
35 | 35 | return mock_hg_wsgi |
|
36 | 36 | |
|
37 | 37 |
@@ -24,7 +24,6 b' import pytest' | |||
|
24 | 24 | import webtest |
|
25 | 25 | |
|
26 | 26 | from rhodecode.lib.middleware.utils import scm_app_http, scm_app |
|
27 | from rhodecode.lib.middleware.simplegit import SimpleGit | |
|
28 | 27 | from rhodecode.lib.vcs.conf import settings |
|
29 | 28 | |
|
30 | 29 | |
@@ -34,7 +33,7 b' def vcs_http_app(vcsserver_http_echo_app' | |||
|
34 | 33 | """ |
|
35 | 34 | git_url = vcsserver_http_echo_app.http_url + 'stream/git/' |
|
36 | 35 | vcs_http_proxy = scm_app_http.VcsHttpProxy( |
|
37 |
git_url, 'stub_path', 'stub_name', None |
|
|
36 | git_url, 'stub_path', 'stub_name', None) | |
|
38 | 37 | app = webtest.TestApp(vcs_http_proxy) |
|
39 | 38 | return app |
|
40 | 39 | |
@@ -112,7 +111,7 b' def vcs_pyro4_app(vcsserver_pyro_echo_ap' | |||
|
112 | 111 | with mock.patch('rhodecode.lib.middleware.utils.scm_app.GIT_REMOTE_WSGI', |
|
113 | 112 | GIT_REMOTE_WSGI): |
|
114 | 113 | pyro4_app = scm_app.create_git_wsgi_app( |
|
115 |
'stub_path', 'stub_name', stub_config |
|
|
114 | 'stub_path', 'stub_name', stub_config) | |
|
116 | 115 | app = webtest.TestApp(pyro4_app) |
|
117 | 116 | return app |
|
118 | 117 |
@@ -133,4 +133,4 b' def create_scm_app():' | |||
|
133 | 133 | """ |
|
134 | 134 | echo_app_url = os.environ["RC_ECHO_URL"] |
|
135 | 135 | return scm_app_http.VcsHttpProxy( |
|
136 |
echo_app_url, 'stub_path', 'stub_name', None |
|
|
136 | echo_app_url, 'stub_path', 'stub_name', None) |
@@ -86,8 +86,7 b' def test_remote_app_caller():' | |||
|
86 | 86 | return (['content'], '200 OK', [('Content-Type', 'text/plain')]) |
|
87 | 87 | |
|
88 | 88 | wrapper_app = wsgi_app_caller_client.RemoteAppCaller( |
|
89 |
RemoteAppCallerMock(), ' |
|
|
90 | 'a1', 'a2', arg3='a3', arg4='a4') | |
|
89 | RemoteAppCallerMock(), 'a1', 'a2', arg3='a3', arg4='a4') | |
|
91 | 90 | |
|
92 | 91 | test_app = webtest.TestApp(wrapper_app) |
|
93 | 92 | |
@@ -95,7 +94,6 b' def test_remote_app_caller():' | |||
|
95 | 94 | |
|
96 | 95 | assert response.status == '200 OK' |
|
97 | 96 | assert sorted(response.headers.items()) == sorted([ |
|
98 | ('X-RhodeCode-Backend', 'dummy-backend'), | |
|
99 | 97 | ('Content-Type', 'text/plain'), |
|
100 | 98 | ('Content-Length', '7'), |
|
101 | 99 | ]) |
General Comments 0
You need to be logged in to leave comments.
Login now