def test_get_repository_branches_with_site_no_access(self): """Testing the GET repositories/<id>/branches/ API with a local site and Permission Denied error""" repository = self.create_repository(with_local_site=True) self.apiGet( get_repository_branches_url(repository, self.local_site_name), expected_status=403)
def setup_basic_get_test(self, user, with_local_site, local_site_name): repository = self.create_repository(tool_name="Test", with_local_site=with_local_site) return ( get_repository_branches_url(repository, local_site_name), repository_branches_item_mimetype, [{"name": "trunk", "commit": "5", "default": True}, {"name": "branch1", "commit": "7", "default": False}], )
def test_get_repository_branches_with_no_support(self): """Testing the GET repositories/<id>/branches/ API with a repository that does not implement it""" repository = self.create_repository(tool_name='Mercurial') rsp = self.apiGet(get_repository_branches_url(repository), expected_status=501) self.assertEqual(rsp['stat'], 'fail') self.assertEqual(rsp['err']['code'], REPO_NOT_IMPLEMENTED.code)
def test_get_with_no_support(self): """Testing the GET repositories/<id>/branches/ API with a repository that does not implement it """ repository = self.create_repository(tool_name="CVS") rsp = self.apiGet(get_repository_branches_url(repository), expected_status=501) self.assertEqual(rsp["stat"], "fail") self.assertEqual(rsp["err"]["code"], REPO_NOT_IMPLEMENTED.code)
def test_get_with_no_support(self): """Testing the GET repositories/<id>/branches/ API with a repository that does not implement it """ repository = self.create_repository(tool_name='CVS') rsp = self.apiGet(get_repository_branches_url(repository), expected_status=501) self.assertEqual(rsp['stat'], 'fail') self.assertEqual(rsp['err']['code'], REPO_NOT_IMPLEMENTED.code)
def setup_basic_get_test(self, user, with_local_site, local_site_name): repository = self.create_repository(tool_name='Test', with_local_site=with_local_site) return (get_repository_branches_url(repository, local_site_name), repository_branches_item_mimetype, [ {'name': 'trunk', 'commit': '5', 'default': True}, {'name': 'branch1', 'commit': '7', 'default': False}, ])
def test_get(self): """Testing the GET repositories/<id>/branches/ API""" repository = self.create_repository(tool_name='Test') rsp = self.apiGet(get_repository_branches_url(repository), expected_mimetype=repository_branches_item_mimetype) self.assertEqual(rsp['stat'], 'ok') self.assertEqual( rsp['branches'], [ {'name': 'trunk', 'commit': '5', 'default': True}, {'name': 'branch1', 'commit': '7', 'default': False}, ])
def test_get_with_no_support(self): """Testing the GET repositories/<id>/branches/ API with a repository that does not implement it """ repository = self.create_repository(tool_name='CVS') try: rsp = self.api_get(get_repository_branches_url(repository), expected_status=501) except ImportError: raise nose.SkipTest("cvs binary not found") self.assertEqual(rsp['stat'], 'fail') self.assertEqual(rsp['err']['code'], REPO_NOT_IMPLEMENTED.code)
def test_get_with_no_support(self): """Testing the GET repositories/<id>/branches/ API with a repository that does not implement it """ repository = self.create_repository(tool_name='CVS') try: rsp = self.api_get(get_repository_branches_url(repository), expected_status=501) except ImportError: raise unittest.SkipTest('cvs binary not found') self.assertEqual(rsp['stat'], 'fail') self.assertEqual(rsp['err']['code'], REPO_NOT_IMPLEMENTED.code)
def setup_basic_get_test(self, user, with_local_site, local_site_name): repository = self.create_repository(tool_name='Test', with_local_site=with_local_site) return (get_repository_branches_url(repository, local_site_name), repository_branches_item_mimetype, [ { 'name': 'trunk', 'commit': '5', 'default': True }, { 'name': 'branch1', 'commit': '7', 'default': False }, ])
def test_get_with_site(self): """Testing the GET repositories/<id>/branches/ API with a local site""" self._login_user(local_site=True) repository = self.create_repository(tool_name='Test', with_local_site=True) rsp = self.apiGet( get_repository_branches_url(repository, self.local_site_name), expected_mimetype=repository_branches_item_mimetype) self.assertEqual(rsp['stat'], 'ok') self.assertEqual( rsp['branches'], [ {'name': 'trunk', 'commit': '5', 'default': True}, {'name': 'branch1', 'commit': '7', 'default': False}, ])
def setup_http_not_allowed_item_test(self, user): repository = self.create_repository(tool_name='Test') return get_repository_branches_url(repository)