#!usr/bin/env python3

import os
import subprocess


def run(commands):
    return subprocess.check_output(commands).decode()


def test_basic_sanitize():
    os.chdir('debian/tests/')
    assert os.path.exists('Test_PDF.pdf')
    assert run(['pdftotext', 'Test_PDF.pdf', '-']).strip() \
           == 'This is a test document.'
    run(['pdf-redact-tools', '-s', 'Test_PDF.pdf'])
    assert os.path.exists('Test_PDF-final.pdf')
    assert run(['pdftotext', 'Test_PDF-final.pdf', '-']).strip() == ''

