summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-02-06 19:57:25 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-20 09:38:18 -0400
commit814cdb9d6ae2aea7a61f92928e5ad77bbd6c87a4 (patch)
treeae04f0c9f7fcda792cb2b86b1c2d4275d1c70fca
parent36a384a683174471d5158b1848a37612b39ca2ee (diff)
downloadpython-systemd-814cdb9d6ae2aea7a61f92928e5ad77bbd6c87a4.tar.gz
tests: check enumerate_fields, has_runtime_fiels, has_persistent_files
-rw-r--r--systemd/test/test_journal.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/systemd/test/test_journal.py b/systemd/test/test_journal.py
index ab155da..152fccf 100644
--- a/systemd/test/test_journal.py
+++ b/systemd/test/test_journal.py
@@ -1,5 +1,6 @@
import logging
import uuid
+import errno
from systemd import journal, id128
import pytest
@@ -80,6 +81,52 @@ def test_reader_this_machine(tmpdir):
j.this_machine(TEST_MID)
j.this_machine(TEST_MID.hex)
+def test_reader_query_unique(tmpdir):
+ j = journal.Reader(path=tmpdir.strpath)
+ with j:
+ try:
+ ans = j.query_unique('FOOBAR')
+ except OSError as e:
+ if e.errno == errno.ENOSYS:
+ return
+ raise
+ assert isinstance(ans, set)
+ assert ans == set()
+
+def test_reader_enumerate_fields(tmpdir):
+ j = journal.Reader(path=tmpdir.strpath)
+ with j:
+ try:
+ ans = j.enumerate_fields()
+ except OSError as e:
+ if e.errno == errno.ENOSYS:
+ pytest.skip()
+ raise
+ assert isinstance(ans, set)
+ assert ans == set()
+
+def test_reader_has_runtime_files(tmpdir):
+ j = journal.Reader(path=tmpdir.strpath)
+ with j:
+ try:
+ ans = j.has_runtime_files()
+ except OSError as e:
+ if e.errno == errno.ENOSYS:
+ pytest.skip()
+ raise
+ assert ans == False
+
+def test_reader_has_persistent_files(tmpdir):
+ j = journal.Reader(path=tmpdir.strpath)
+ with j:
+ try:
+ ans = j.has_runtime_files()
+ except OSError as e:
+ if e.errno == errno.ENOSYS:
+ pytest.skip()
+ raise
+ assert ans == False
+
def test_reader_converters(tmpdir):
converters = {'xxx' : lambda arg: 'yyy'}
j = journal.Reader(path=tmpdir.strpath, converters=converters)