Coverage for tests/test_panda_auth_utils.py: 53%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

13 statements  

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 "IDDS_CONFIG", 

19 } 

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

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

22 with self.assertRaises(OSError): 

23 panda_auth_status() 

24 

25 

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

27 unittest.main()