Coverage for tests/test_panda_auth_utils.py: 43%

13 statements  

« prev     ^ index     » next       coverage.py v6.4.1, created at 2022-06-08 01:00 -0700

1"""Unit tests for PanDA authentication utilities. 

2""" 

3import os 

4import unittest 

5from unittest import mock 

6 

7from lsst.ctrl.bps.panda.panda_auth_utils import panda_auth_status 

8 

9 

10class TestPandaAuthUtils(unittest.TestCase): 

11 def testPandaAuthStatusWrongEnviron(self): 

12 unwanted = { 

13 "PANDA_AUTH", 

14 "PANDA_VERIFY_HOST", 

15 "PANDA_AUTH_VO", 

16 "PANDA_URL_SSL", 

17 "PANDA_URL", 

18 } 

19 test_environ = {key: val for key, val in os.environ.items() if key not in unwanted} 

20 with mock.patch.dict(os.environ, test_environ, clear=True): 

21 with self.assertRaises(OSError): 

22 panda_auth_status() 

23 

24 

25if __name__ == "__main__": 25 ↛ 26line 25 didn't jump to line 26, because the condition on line 25 was never true

26 unittest.main()