Exemple #1
0
def test_ledger_two_files(capsys):
    assert RESOURCE_BASE.check(dir=1)
    src1 = RESOURCE_BASE.join('files/rpt_test-100000.pdf')
    src2 = RESOURCE_BASE.join('files/rpt_test-100001.pdf')
    assert src1.check(file=1)
    assert src2.check(file=1)
    run([str(src1), str(src2)], True, 'test/resources/arbor-ledger.json',
        'test/resources/arbor-public.key')
    captured = capsys.readouterr()
    assert captured.err == ''
    lines = captured.out.splitlines()
    sorted_lines = sorted(lines)
    print(sorted_lines)
    assert len(lines) == 2
Exemple #2
0
def test_ledger_basic(capsys):
    returncode = run(['test/resources/files'], True,
                     'test/resources/arbor-ledger.json',
                     'test/resources/arbor-public.key')
    captured = capsys.readouterr()
    assert captured.err == ''
    lines = captured.out.splitlines()
    sorted_lines = sorted(lines)
    with open('test/resources/expected_a.txt') as fin:
        expected = fin.read()
    expected_lines = expected.splitlines()
    assert sorted_lines == expected_lines
    assert returncode == 0
Exemple #3
0
def test_ledger_bad_key():
    with pytest.raises(Exception):
        run(['test/resources/files'], True, 'test/resources/arbor-ledger.json',
            'test/resources/bad-key.key')
Exemple #4
0
def test_ledger_bad_ledger():
    with pytest.raises(ValueError):
        run(['test/resources/files'], True, 'test/resources/bad-ledger-a.json',
            'test/resources/arbor-public.key')
Exemple #5
0
def test_ledger_missing_input():
    with pytest.raises(ValueError):
        run(['test/resources/missing'], True,
            'test/resources/arbor-ledger.json',
            'test/resources/arbor-public.key')