Changeset - 5d7a1997a8d9
[Not reviewed]
default
0 1 0
Mads Kiilerich - 7 years ago 2018-12-29 16:17:31
mads@kiilerich.com
tests: merge tests that depend on each other

The tests would fail when run separately, for example when running:

py.test -k perm
1 file changed with 15 insertions and 19 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/functional/test_forks.py
Show inline comments
 
@@ -186,7 +186,7 @@ class _BaseTestCase(TestController):
 
        response = self.app.post(url('delete_repo', repo_name=fork_name),
 
            params={'_authentication_token': self.authentication_token()})
 

	
 
    def test_z_fork_create(self):
 
    def test_fork_create_and_permissions(self):
 
        self.log_user()
 
        fork_name = self.REPO_FORK
 
        description = 'fork of vcs test'
 
@@ -226,9 +226,7 @@ class _BaseTestCase(TestController):
 
        response.mustcontain(self.REPO_TYPE)
 
        response.mustcontain('Fork of "<a href="/%s">%s</a>"' % (repo_name, repo_name))
 

	
 
    def test_zz_fork_permission_page(self):
 
        usr = self.log_user(self.username, self.password)['user_id']
 
        repo_name = self.REPO
 

	
 
        forks = Repository.query() \
 
            .filter(Repository.repo_type == self.REPO_TYPE) \
 
@@ -246,23 +244,21 @@ class _BaseTestCase(TestController):
 

	
 
        response.mustcontain('<div>fork of vcs test</div>')
 

	
 
    def test_zzz_fork_permission_page(self):
 
        usr = self.log_user(self.username, self.password)['user_id']
 
        repo_name = self.REPO
 

	
 
        forks = Repository.query() \
 
            .filter(Repository.repo_type == self.REPO_TYPE) \
 
            .filter(Repository.fork_id != None).all()
 
        assert 1 == len(forks)
 
        # remove permissions
 
        try:
 
            RepoModel().grant_user_permission(repo=forks[0],
 
                                              user=usr, perm='repository.none')
 
            Session().commit()
 

	
 
        # set none
 
        RepoModel().grant_user_permission(repo=forks[0],
 
                                          user=usr, perm='repository.none')
 
        Session().commit()
 
        # fork shouldn't be there
 
        response = self.app.get(url(controller='forks', action='forks',
 
                                    repo_name=repo_name))
 
        response.mustcontain('There are no forks yet')
 
            # fork shouldn't be visible
 
            response = self.app.get(url(controller='forks', action='forks',
 
                                        repo_name=repo_name))
 
            response.mustcontain('There are no forks yet')
 

	
 
        finally:
 
            RepoModel().grant_user_permission(repo=forks[0],
 
                                              user=usr, perm='repository.read')
 
            RepoModel().delete(repo=forks[0])
 

	
 

	
 
class TestGIT(_BaseTestCase):
0 comments (0 inline, 0 general)