changeset 6461:a918c4c5a841

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.
author Søren Løvborg <sorenl@unity3d.com>
date Tue, 17 Jan 2017 17:47:33 +0100
parents 63460acc2569
children c8f34ad333a2
files kallithea/tests/functional/test_admin_repos.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/functional/test_admin_repos.py	Fri Jan 06 14:57:19 2017 +0100
+++ b/kallithea/tests/functional/test_admin_repos.py	Tue Jan 17 17:47:33 2017 +0100
@@ -612,6 +612,11 @@
     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,
+        )