Changeset - a918c4c5a841
[Not reviewed]
default
0 1 0
Søren Løvborg - 9 years ago 2017-01-17 17:47:33
sorenl@unity3d.com
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.
1 file changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/functional/test_admin_repos.py
Show inline comments
 
@@ -591,27 +591,32 @@ class _BaseTestCase(TestController):
 
        # repo must not be in db
 
        repo = Repository.get_by_repo_name(repo_name)
 
        assert repo == None
 

	
 
        # repo must not be in filesystem !
 
        assert not os.path.isdir(os.path.join(Ui.get_by_key('paths', '/').ui_value, repo_name))
 

	
 

	
 
class TestAdminReposControllerGIT(_BaseTestCase):
 
    REPO = GIT_REPO
 
    REPO_TYPE = 'git'
 
    NEW_REPO = NEW_GIT_REPO
 
    OTHER_TYPE_REPO = HG_REPO
 
    OTHER_TYPE = 'hg'
 

	
 

	
 
class TestAdminReposControllerHG(_BaseTestCase):
 
    REPO = HG_REPO
 
    REPO_TYPE = 'hg'
 
    NEW_REPO = NEW_HG_REPO
 
    OTHER_TYPE_REPO = GIT_REPO
 
    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,
 
        )
0 comments (0 inline, 0 general)