Exemple #1
0
def test_stamp_call(capfd, caplog):
    _ = setup_environment()
    _ = cli_stamp_notes(ORIGINAL_CONFIG)
    # Validate stdout
    captured = capfd.readouterr()
    old_line_count, new_line_count, file_count = 0, 0, 0
    for line in captured.out.split('\n'):
        if '(old):' in line:
            old_line_count += 1
        if '(new):' in line:
            new_line_count += 1
        if line.startswith('<<--') and line.endswith('-->>'):
            file_count += 1
    assert new_line_count == old_line_count
    assert file_count == 4

    # Validate that we only get DEBUG and INFO log messages
    for record in caplog.records:
        assert record.levelname in ['DEBUG', 'INFO']

    teardown_environment()
Exemple #2
0
 def teardown_class(self):
     '''Ensure that we don't leave stamped
     notes around after the tests are run
     '''
     teardown_environment()