Skip to content

Commit 7cd7a9c

Browse files
committed
test: add splunk's module patch
1 parent 087f2a7 commit 7cd7a9c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/integration/context.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ def get_session_key():
3535
)
3636
content = response.json()
3737
return content["sessionKey"]
38+
39+
40+
def mock_splunk(monkeypatch):
41+
def simple_requests(url, *args, **kwargs):
42+
from splunk.rest import simpleRequest
43+
return simpleRequest(url, *args, **kwargs)
44+
45+
monkeypatch.setattr("solnlib.splunkenv.simpleRequest", simple_requests)

tests/integration/test_conf_manager.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ def test_conf_manager_update_conf_with_encrypted_keys():
153153
assert conf_file.get("stanza")["key2"] == "value2"
154154

155155

156-
def test_get_log_level():
156+
def test_get_log_level(monkeypatch):
157+
context.mock_splunk(monkeypatch)
158+
157159
session_key = context.get_session_key()
158160
expected_log_level = "DEBUG"
159161

@@ -168,7 +170,9 @@ def test_get_log_level():
168170
assert expected_log_level == log_level
169171

170172

171-
def test_get_log_level_incorrect_log_level_field():
173+
def test_get_log_level_incorrect_log_level_field(monkeypatch):
174+
context.mock_splunk(monkeypatch)
175+
172176
session_key = context.get_session_key()
173177
expected_log_level = "INFO"
174178

0 commit comments

Comments
 (0)