Renamed tests and added human readable descriptions.
This commit is contained in:
54
tests.py
54
tests.py
@@ -6,46 +6,60 @@ from devops import Organization, Repository, Project, Item
|
||||
# Each Unit test instantinates the class, so doing it here avoids repeated authentication.
|
||||
org = Organization("https://dev.azure.com/mcovsandbox")
|
||||
|
||||
class TestDevOps(unittest.TestCase):
|
||||
class Test01(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.org = org
|
||||
|
||||
def test_listing_projects_in_organization(self):
|
||||
def test_01(self):
|
||||
"""Listing projects in the organization"""
|
||||
org = self.org
|
||||
projects = list(org.projects)
|
||||
self.assertGreater(len(projects), 0)
|
||||
|
||||
def test_listing_repositories_in_project(self):
|
||||
class Test02(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.org = org
|
||||
|
||||
def test_01(self):
|
||||
"""Listing repositories in a project"""
|
||||
project = Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727")
|
||||
repos = list(project.repositories)
|
||||
self.assertGreater(len(repos), 0)
|
||||
|
||||
def test_fetching_repository_by_name_or_id(self):
|
||||
project = Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727")
|
||||
self.assertIsNotNone(project)
|
||||
repo_by_name = Repository(project, id="ado-auth-lab")
|
||||
self.assertIsNotNone(repo_by_name)
|
||||
self.assertEqual(repo_by_name.name, "ado-auth-lab")
|
||||
self.assertEqual(repo_by_name.id, "feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
repo_by_id = Repository(project, id="feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
self.assertEqual(repo_by_id.name, "ado-auth-lab")
|
||||
self.assertEqual(repo_by_id.id, "feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
class Test03(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.org = org
|
||||
|
||||
def test_listing_items_in_repository(self):
|
||||
repo = Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
items = list(repo.items)
|
||||
self.assertGreater(len(items), 0)
|
||||
|
||||
def test_getting_specific_item_details(self):
|
||||
def test_01(self):
|
||||
"""Getting details of a specific item in a repository"""
|
||||
item = Item(Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa"), path="/generate-pat.py")
|
||||
self.assertEqual(item.path, "/generate-pat.py")
|
||||
self.assertIsNotNone(item.commit_id)
|
||||
|
||||
def test_listing_descendant_items_in_folder(self):
|
||||
def test_02(self):
|
||||
"""Listing items in a folder within a repository"""
|
||||
repo = Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
docs_item = Item(repo, path="/container")
|
||||
children = list(docs_item.children)
|
||||
self.assertGreater(len(children), 0)
|
||||
|
||||
class Test04(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.org = org
|
||||
|
||||
def test_01(self):
|
||||
"""Getting details of a specific item in a repository"""
|
||||
item = Item(Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa"), path="/generate-pat.py")
|
||||
self.assertEqual(item.path, "/generate-pat.py")
|
||||
self.assertIsNotNone(item.commit_id)
|
||||
|
||||
def test_02(self):
|
||||
"""Listing items in a folder within a repository"""
|
||||
repo = Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
docs_item = Item(repo, path="/container")
|
||||
children = list(docs_item.children)
|
||||
self.assertGreater(len(children), 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user