Skip to content

Commit a549310

Browse files
committed
Test attempt to perform operation without being logged in.
1 parent 5e6cb9c commit a549310

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_service.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import splunklib.data as data
2323

2424
import splunklib.client as client
25+
from splunklib.client import AuthenticationError
26+
from splunklib.client import Service
2527
from splunklib.binding import HTTPError
2628

2729
class ServiceTestCase(testlib.SDKTestCase):
@@ -104,6 +106,15 @@ def test_splunk_version(self):
104106
for version in [(4,3,3), (5,), (5,0,1)]:
105107
with self.fake_splunk_version(version):
106108
self.assertEqual(version, self.service.splunk_version)
109+
110+
def test_query_without_login(self):
111+
service = Service()
112+
try:
113+
service.splunk_version
114+
self.fail('Expected AuthenticationError.')
115+
except AuthenticationError:
116+
# Good
117+
pass
107118

108119
class TestSettings(testlib.SDKTestCase):
109120
def test_read_settings(self):

0 commit comments

Comments
 (0)