@@ -167,6 +167,54 @@ class TestAdminUsersController(TestContr
self.checkSessionFlash(response, 'Successfully deleted user')
def test_delete_repo_err(self):
self.log_user()
username = 'repoerr'
reponame = 'repoerr_fail'
fixture.create_user(name=username)
fixture.create_repo(name=reponame, cur_user=username)
new_user = Session().query(User)\
.filter(User.username == username).one()
response = self.app.delete(url('user', id=new_user.user_id))
self.checkSessionFlash(response, 'User "%s" still '
'owns 1 repositories and cannot be removed. '
'Switch owners or remove those repositories: '
'%s' % (username, reponame))
response = self.app.delete(url('repo', repo_name=reponame))
self.checkSessionFlash(response, 'Deleted repository %s' % reponame)
def test_delete_repo_group_err(self):
username = 'repogrouperr'
groupname = 'repogroup_fail'
fixture.create_repo_group(name=groupname, cur_user=username)
'owns 1 repository groups and cannot be removed. '
'Switch owners or remove those repository groups: '
'%s' % (username, groupname))
# Relevant _if_ the user deletion succeeded to make sure we can render groups without owner
# rg = RepoGroup.get_by_group_name(group_name=groupname)
# response = self.app.get(url('repos_groups', id=rg.group_id))
response = self.app.delete(url('delete_repo_group', group_name=groupname))
self.checkSessionFlash(response, 'Removed repository group %s' % groupname)
def test_show(self):
response = self.app.get(url('user', id=1))
Status change: