Added finding projects by id and name using an indexer.

This commit is contained in:
2025-11-03 01:55:43 +01:00
parent 6bc913d43e
commit f43564d019
3 changed files with 31 additions and 8 deletions

View File

@@ -15,6 +15,21 @@ class Test01(unittest.TestCase):
org = self.org
projects = list(org.projects)
self.assertGreater(len(projects), 0)
def test_02(self):
"""Getting a specific project by ID (object instantiation)"""
project = Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727")
self.assertEqual(project.id, "bafe0cf1-6c97-4088-864a-ea6dc02b2727")
self.assertEqual(project.name, "ADO Sandbox")
def test_03(self):
"""Getting a specific project by name using org indexing (object retrieval)"""
project = self.org["ADO Sandbox"]
self.assertEqual(project.id, "bafe0cf1-6c97-4088-864a-ea6dc02b2727")
self.assertEqual(project.name, "ADO Sandbox")
def test_04(self):
"""Getting a specific project by ID using org indexing (object retrieval)"""
project = self.org["bafe0cf1-6c97-4088-864a-ea6dc02b2727"]
self.assertEqual(project.id, "bafe0cf1-6c97-4088-864a-ea6dc02b2727")
self.assertEqual(project.name, "ADO Sandbox")
class Test02(unittest.TestCase):
def setUp(self):