| 1 |
""" |
| 2 |
:Requirement: 389-ds-base: Command Line Utility |
| 3 |
""" |
| 4 |
|
| 5 |
import logging |
| 6 |
|
| 7 |
|
| 8 |
log = logging.getLogger(__name__) |
| 9 |
|
| 10 |
def check_value_in_log_and_reset(topology, content_list=None, content_list2=None, check_value=None, |
| 11 |
check_value_not=None): |
| 12 |
|
| 13 |
check_value_in_log(topology, content_list, content_list2, check_value, check_value_not) |
| 14 |
|
| 15 |
log.info('Reset the log for next test') |
| 16 |
topology.logcap.flush() |
| 17 |
|
| 18 |
|
| 19 |
def check_value_in_log(topology, content_list=None, content_list2=None, check_value=None, |
| 20 |
check_value_not=None): |
| 21 |
if content_list2 is not None: |
| 22 |
log.info('Check if content is present in output') |
| 23 |
for item in content_list + content_list2: |
| 24 |
assert topology.logcap.contains(item) |
| 25 |
|
| 26 |
if content_list is not None: |
| 27 |
log.info('Check if content is present in output') |
| 28 |
for item in content_list: |
| 29 |
assert topology.logcap.contains(item) |
| 30 |
|
| 31 |
if check_value is not None: |
| 32 |
log.info('Check if value is present in output') |
| 33 |
assert topology.logcap.contains(check_value) |
| 34 |
|
| 35 |
if check_value_not is not None: |
| 36 |
log.info('Check if value is not present in output') |
| 37 |
assert not topology.logcap.contains(check_value_not) |