# HG changeset patch # User Søren Løvborg # Date 2017-01-17 17:47:33 # Node ID a918c4c5a841f0d7963c3f42e09e31c9e6b82229 # Parent 63460acc2569828c6efd4596236bb045f3375ef1 tests: fix test_permanent_url_protocol_access instability Since the test repositories are created in the database by scanning the file system, their IDs depends on the (non-deterministic) order in which files are listed by the file system. The solution, of course, is to ask the database for the ID instead of assuming it will be ID 1. diff --git a/kallithea/tests/functional/test_admin_repos.py b/kallithea/tests/functional/test_admin_repos.py --- a/kallithea/tests/functional/test_admin_repos.py +++ b/kallithea/tests/functional/test_admin_repos.py @@ -612,6 +612,11 @@ class TestAdminReposControllerHG(_BaseTe OTHER_TYPE = 'git' def test_permanent_url_protocol_access(self): + repo = Repository.get_by_repo_name(self.REPO) + permanent_name = '_%d' % repo.repo_id + # 400 Bad Request - Unable to detect pull/push action - self.app.get(url('summary_home', repo_name='_1'), extra_environ={'HTTP_ACCEPT': 'application/mercurial'}, - status=400) + self.app.get(url('summary_home', repo_name=permanent_name), + extra_environ={'HTTP_ACCEPT': 'application/mercurial'}, + status=400, + )