Skip to content

Commit 28cee07

Browse files
committed
Split test_query_without_login() into two tests.
1 parent cd10ffa commit 28cee07

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/test_service.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,19 @@ def test_splunk_version(self):
107107
with self.fake_splunk_version(version):
108108
self.assertEqual(version, self.service.splunk_version)
109109

110-
def test_query_without_login(self):
110+
def test_query_without_login_raises_auth_error(self):
111111
service = self._create_unauthenticated_service()
112-
113-
# Ensure raises AuthenticationError
114112
self.assertRaises(AuthenticationError, lambda: service.indexes.list())
115-
116-
# Ensure raises HTTPError 401
113+
114+
# This behavior is needed for backward compatibility for code
115+
# prior to the introduction of AuthenticationError
116+
def test_query_without_login_raises_http_401(self):
117+
service = self._create_unauthenticated_service()
117118
try:
118119
service.indexes.list()
119120
self.fail('Expected HTTP 401.')
120121
except HTTPError as he:
121-
if he.code == 401:
122+
if he.status == 401:
122123
# Good
123124
pass
124125
else:

0 commit comments

Comments
 (0)