Coverage for tests/test_panda_auth_utils.py: 44%
17 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-08 22:37 -0800
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-08 22:37 -0800
1"""Unit tests for PanDA authentication utilities.
2"""
3import os
4import unittest
5from unittest import mock
7from lsst.ctrl.bps.panda import __version__ as version
8from lsst.ctrl.bps.panda.panda_auth_utils import panda_auth_status
11class VersionTestCase(unittest.TestCase):
12 def test_version(self):
13 # Check that version is defined.
14 self.assertIsNotNone(version)
17class TestPandaAuthUtils(unittest.TestCase):
18 def testPandaAuthStatusWrongEnviron(self):
19 unwanted = {
20 "PANDA_AUTH",
21 "PANDA_VERIFY_HOST",
22 "PANDA_AUTH_VO",
23 "PANDA_URL_SSL",
24 "PANDA_URL",
25 }
26 test_environ = {key: val for key, val in os.environ.items() if key not in unwanted}
27 with mock.patch.dict(os.environ, test_environ, clear=True):
28 with self.assertRaises(OSError):
29 panda_auth_status()
32if __name__ == "__main__": 32 ↛ 33line 32 didn't jump to line 33, because the condition on line 32 was never true
33 unittest.main()