Skip to content

Commit 5d5a60b

Browse files
committed
Expose published and author fields
Fixes #619
1 parent bf6ed38 commit 5d5a60b

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

splunklib/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ def _parse_atom_entry(entry):
279279
"fields": metadata.fields,
280280
"content": content,
281281
"updated": entry.get("updated"),
282+
"published": entry.get("published"),
283+
"author": entry.get("author"),
282284
}
283285
)
284286

tests/integration/test_job.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
# under the License.
1616

1717
from io import BytesIO
18+
import logging
1819
from pathlib import Path
1920
from time import sleep
21+
from datetime import datetime
2022

2123
import io
2224

@@ -438,6 +440,19 @@ def test_v1_job_fallback(self):
438440
self.assertTrue(client.PATH_JOBS_V2 in self.job.path)
439441
self.assertEqual(n_events, n_preview, n_results)
440442

443+
def test_published_author_fields(self):
444+
logging.basicConfig(force=True, level=logging.DEBUG)
445+
446+
jobs = self.service.jobs.list(name=self.job.name)
447+
self.assertEqual(len(jobs), 1)
448+
self.assertEqual(jobs[0].state.author.name, self.service.username)
449+
self.assertIsNotNone(jobs[0].state.published)
450+
datetime.fromisoformat(jobs[0].state.published) # make sure it is parsable
451+
452+
self.assertEqual(self.job.state.author.name, self.service.username)
453+
self.assertIsNotNone(self.job.state.published)
454+
datetime.fromisoformat(self.job.state.published) # make sure it is parsable
455+
441456

442457
if __name__ == "__main__":
443458
unittest.main()

tests/system/test_apps/modularinput_app/bin/modularinput.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class ModularInput(Script):
2424
"""
25-
This app provides an example of a modular input that
25+
This app provides an example of a modular input that
2626
can be used in Settings => Data inputs => Local inputs => modularinput
2727
"""
2828

0 commit comments

Comments
 (0)