|
1 | 1 | import logging |
2 | 2 | import uuid |
| 3 | +import errno |
3 | 4 | from systemd import journal, id128 |
4 | 5 |
|
5 | 6 | import pytest |
@@ -80,6 +81,52 @@ def test_reader_this_machine(tmpdir): |
80 | 81 | j.this_machine(TEST_MID) |
81 | 82 | j.this_machine(TEST_MID.hex) |
82 | 83 |
|
| 84 | +def test_reader_query_unique(tmpdir): |
| 85 | + j = journal.Reader(path=tmpdir.strpath) |
| 86 | + with j: |
| 87 | + try: |
| 88 | + ans = j.query_unique('FOOBAR') |
| 89 | + except OSError as e: |
| 90 | + if e.errno == errno.ENOSYS: |
| 91 | + return |
| 92 | + raise |
| 93 | + assert isinstance(ans, set) |
| 94 | + assert ans == set() |
| 95 | + |
| 96 | +def test_reader_enumerate_fields(tmpdir): |
| 97 | + j = journal.Reader(path=tmpdir.strpath) |
| 98 | + with j: |
| 99 | + try: |
| 100 | + ans = j.enumerate_fields() |
| 101 | + except OSError as e: |
| 102 | + if e.errno == errno.ENOSYS: |
| 103 | + pytest.skip() |
| 104 | + raise |
| 105 | + assert isinstance(ans, set) |
| 106 | + assert ans == set() |
| 107 | + |
| 108 | +def test_reader_has_runtime_files(tmpdir): |
| 109 | + j = journal.Reader(path=tmpdir.strpath) |
| 110 | + with j: |
| 111 | + try: |
| 112 | + ans = j.has_runtime_files() |
| 113 | + except OSError as e: |
| 114 | + if e.errno == errno.ENOSYS: |
| 115 | + pytest.skip() |
| 116 | + raise |
| 117 | + assert ans == False |
| 118 | + |
| 119 | +def test_reader_has_persistent_files(tmpdir): |
| 120 | + j = journal.Reader(path=tmpdir.strpath) |
| 121 | + with j: |
| 122 | + try: |
| 123 | + ans = j.has_runtime_files() |
| 124 | + except OSError as e: |
| 125 | + if e.errno == errno.ENOSYS: |
| 126 | + pytest.skip() |
| 127 | + raise |
| 128 | + assert ans == False |
| 129 | + |
83 | 130 | def test_reader_converters(tmpdir): |
84 | 131 | converters = {'xxx' : lambda arg: 'yyy'} |
85 | 132 | j = journal.Reader(path=tmpdir.strpath, converters=converters) |
|
0 commit comments