| 1 |
# -------------------------------------------------------------------------------------------- |
| 2 |
# Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 |
# Licensed under the MIT License. See License.txt in the project root for license information. |
| 4 |
# -------------------------------------------------------------------------------------------- |
| 5 |
|
| 6 |
import logging |
| 7 |
import unittest |
| 8 |
from azure_functions_devops_build.pool.pool_manager import PoolManager |
| 9 |
from ._config import CREATE_DEVOPS_OBJECTS, ORGANIZATION_NAME, PROJECT_NAME |
| 10 |
from ._helpers import get_credentials |
| 11 |
|
| 12 |
class TestPoolManager(unittest.TestCase): |
| 13 |
@classmethod |
| 14 |
def setUpClass(cls): |
| 15 |
logging.disable(logging.CRITICAL) |
| 16 |
|
| 17 |
@classmethod |
| 18 |
def tearDownClass(cls): |
| 19 |
logging.disable(logging.NOTSET) |
| 20 |
|
| 21 |
def setUp(self): |
| 22 |
self.pool_manager = PoolManager( |
| 23 |
organization_name=ORGANIZATION_NAME, |
| 24 |
project_name=PROJECT_NAME, |
| 25 |
creds=get_credentials() |
| 26 |
) |
| 27 |
|
| 28 |
def tearDown(self): |
| 29 |
self.pool_manager.close_connection() |
| 30 |
|
| 31 |
def test_list_pools(self): |
| 32 |
pools = self.pool_manager.list_pools() |
| 33 |
self.assertIsNotNone(pools) |
| 34 |
self.assertIsNotNone(pools.value) |
| 35 |
self.assertGreaterEqual(pools.count, 0) |
| 36 |
|
| 37 |
if __name__ == '__main__': |
| 38 |
unittest.main() |