Reorganized test setup to avoid repeated authentication during tests.
This commit is contained in:
		
							
								
								
									
										11
									
								
								tests.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tests.py
									
									
									
									
									
								
							@@ -1,15 +1,14 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
import unittest
 | 
			
		||||
from devops import DEVOPS_SCOPE, Organization, Repository, Project, Item
 | 
			
		||||
from azure.identity import DefaultAzureCredential
 | 
			
		||||
from devops import Organization, Repository, Project, Item
 | 
			
		||||
 | 
			
		||||
# Example: set up your org here if possible, or mock as needed
 | 
			
		||||
# org = Organization("https://dev.azure.com/mcovsandbox", DefaultAzureCredential().get_token(DEVOPS_SCOPE).token)
 | 
			
		||||
# Setup the Organization object outside the test class to speed up tests.
 | 
			
		||||
# Each Unit test instantinates the class, so doing it here avoids repeated authentication.
 | 
			
		||||
org = Organization("https://dev.azure.com/mcovsandbox")
 | 
			
		||||
 | 
			
		||||
class TestDevOps(unittest.TestCase):
 | 
			
		||||
    def setUp(self):
 | 
			
		||||
        # Set up your Organization object here if possible
 | 
			
		||||
        self.org = Organization("https://dev.azure.com/mcovsandbox", DefaultAzureCredential().get_token(DEVOPS_SCOPE).token)
 | 
			
		||||
        self.org = org
 | 
			
		||||
 | 
			
		||||
    def test_listing_projects_in_organization(self):
 | 
			
		||||
        org = self.org
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user