From 814cdb9d6ae2aea7a61f92928e5ad77bbd6c87a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 6 Feb 2016 19:57:25 -0500 Subject: tests: check enumerate_fields, has_runtime_fiels, has_persistent_files --- systemd/test/test_journal.py | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) 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) -- cgit v1.2.1