From 80fe32595275e83ee94ae7bf93423cba21a1cda4 Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Mon, 11 Aug 2025 15:36:57 +0200 Subject: [PATCH] Set autologin=True while running tests. When autologin is set to False, the client does not attempt to re-authenticate on a 401 response and instead fails with an AuthenticationError. --- tests/test_service.py | 3 ++- tests/testlib.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_service.py b/tests/test_service.py index 971764c0e..850eab3f0 100755 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -26,7 +26,8 @@ class ServiceTestCase(testlib.SDKTestCase): def test_autologin(self): - service = client.connect(autologin=True, **self.opts.kwargs) + self.assertTrue(self.opts.kwargs.get("autologin")) + service = client.connect(**self.opts.kwargs) self.service.restart(timeout=120) reader = service.jobs.oneshot("search index=internal | head 1") self.assertIsNotNone(reader) diff --git a/tests/testlib.py b/tests/testlib.py index 57ab1f2da..b3a41a889 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -233,7 +233,7 @@ def restartSplunk(self, timeout=240): @classmethod def setUpClass(cls): cls.opts = parse([], {}, ".env") - cls.opts.kwargs.update({"retries": 3}) + cls.opts.kwargs.update({"retries": 3, "autologin": True}) # Before we start, make sure splunk doesn't need a restart. service = client.connect(**cls.opts.kwargs) if service.restart_required: