def get_azure_devops_repository_branches(self, organization_name, project_name, repository_name): """Get Azure Devops repository branches""" repository_manager = RepositoryManager( organization_name=organization_name, project_name=project_name, creds=self._creds ) return repository_manager.get_azure_devops_repository_branches(repository_name)
class TestRepositoryManager(unittest.TestCase): @classmethod def setUpClass(cls): logging.disable(logging.CRITICAL) @classmethod def tearDownClass(cls): logging.disable(logging.NOTSET) def setUp(self): self.repository_manager = RepositoryManager( organization_name=ORGANIZATION_NAME, project_name=PROJECT_NAME, creds=get_credentials()) def test_get_repo_branches(self): result = self.repository_manager.get_azure_devops_repository_branches( REPOSITORY_NAME) self.assertIsNotNone(result) self.assertGreaterEqual(len(result), 0) def test_get_repo(self): result = self.repository_manager.get_azure_devops_repository( REPOSITORY_NAME) if result is not None: self.assertEqual(result.name, REPOSITORY_NAME) def test_invalid_get_repo_bad_name(self): result = self.repository_manager.get_azure_devops_repository( "bad@name") self.assertIsNone(result) def test_create_repository(self): result = self.repository_manager.get_azure_devops_repository( REPOSITORY_NAME) if result is None: repository = self.repository_manager.create_repository( REPOSITORY_NAME) self.assertEqual(repository.name, REPOSITORY_NAME) def test_list_repositories(self): result = self.repository_manager.list_repositories() self.assertIsNotNone(result) self.assertGreaterEqual(len(result), 0) def test_list_commits(self): result = self.repository_manager.list_commits(REPOSITORY_NAME) self.assertIsNotNone(result) self.assertGreaterEqual(len(result), 0)