Skip to content

Removed strip() method in load_value() method from data.py file #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions splunklib/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def load_value(element, nametable=None):
text = element.text
if text is None:
return None
text = text.strip()
if len(text) == 0:

if len(text.strip()) == 0:
return None
return text

Expand Down
10 changes: 10 additions & 0 deletions tests/test_storage_passwords.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ def test_delete(self):
self.storage_passwords.delete(username + "/foo", "/myrealm")
self.assertEqual(start_count, len(self.storage_passwords))

def test_spaces_in_username(self):
start_count = len(self.storage_passwords)
realm = testlib.tmpname()
username = " user1 "

p = self.storage_passwords.create("changeme", username, realm)
self.assertEqual(p.username, username)

p.delete()
self.assertEqual(start_count, len(self.storage_passwords))

if __name__ == "__main__":
try:
Expand Down