# HG changeset patch # User Marcin Kuzminski # Date 2018-01-29 16:13:24 # Node ID 7c7f631d0417a2eb3bc16d37e1c8388412471a79 # Parent 5fe36cd703949fee10f7b61095ca7fbac75bc959 tests: fixed clone url tests. diff --git a/rhodecode/apps/repository/tests/test_repo_summary.py b/rhodecode/apps/repository/tests/test_repo_summary.py --- a/rhodecode/apps/repository/tests/test_repo_summary.py +++ b/rhodecode/apps/repository/tests/test_repo_summary.py @@ -56,6 +56,16 @@ def route_path(name, params=None, **kwar return base_url +def assert_clone_url(response, server, repo, disabled=False): + + response.mustcontain( + ''.format( + server=server, repo=repo, disabled='disabled ' if disabled else ' ') + ) + + @pytest.mark.usefixtures('app') class TestSummaryView(object): def test_index(self, autologin_user, backend, http_host_only_stub): @@ -76,12 +86,8 @@ class TestSummaryView(object): ) # clone url... - response.mustcontain( - 'id="clone_url" readonly="readonly"' - ' value="http://test_admin@%s/%s"' % (http_host_only_stub, repo_name, )) - response.mustcontain( - 'id="clone_url_id" readonly="readonly"' - ' value="http://test_admin@%s/_%s"' % (http_host_only_stub, repo_id, )) + assert_clone_url(response, http_host_only_stub, repo_name) + assert_clone_url(response, http_host_only_stub, '_{}'.format(repo_id)) def test_index_svn_without_proxy( self, autologin_user, backend_svn, http_host_only_stub): @@ -89,12 +95,9 @@ class TestSummaryView(object): repo_name = backend_svn.repo_name response = self.app.get(route_path('repo_summary', repo_name=repo_name)) # clone url... - response.mustcontain( - 'id="clone_url" disabled' - ' value="http://test_admin@%s/%s"' % (http_host_only_stub, repo_name, )) - response.mustcontain( - 'id="clone_url_id" disabled' - ' value="http://test_admin@%s/_%s"' % (http_host_only_stub, repo_id, )) + + assert_clone_url(response, http_host_only_stub, repo_name, disabled=True) + assert_clone_url(response, http_host_only_stub, '_{}'.format(repo_id), disabled=True) def test_index_with_trailing_slash( self, autologin_user, backend, http_host_only_stub): @@ -108,12 +111,8 @@ class TestSummaryView(object): status=200) # clone url... - response.mustcontain( - 'id="clone_url" readonly="readonly"' - ' value="http://test_admin@%s/%s"' % (http_host_only_stub, repo_name, )) - response.mustcontain( - 'id="clone_url_id" readonly="readonly"' - ' value="http://test_admin@%s/_%s"' % (http_host_only_stub, repo_id, )) + assert_clone_url(response, http_host_only_stub, repo_name) + assert_clone_url(response, http_host_only_stub, '_{}'.format(repo_id)) def test_index_by_id(self, autologin_user, backend): repo_id = backend.repo.repo_id