Exemple #1
0
def test_ok_ham34():
    tmp = maketemp()
    mockqsf = os.path.join(tmp, 'mock-qsf')
    writeFile(
        mockqsf,
        """\
#!/bin/sh
test "$#" = "2"
test "$1" = "--test"
test "$2" = "--rating"
test "$(cat)" = "fake-email"
echo 34
exit 0
""")
    os.chmod(mockqsf, 0755)
    message = os.path.join(tmp, 'fake-email')
    writeFile(
        message,
        'fake email',
        )
    got = spamminess.spamminess(
        path=message,
        _qsf=mockqsf,
        )
    eq(got, 34)
Exemple #2
0
def test_file_not_found():
    tmp = maketemp()
    path = os.path.join(tmp, 'does-not-exist')
    got = spamminess.spamminess(
        path=path,
        _qsf='should-not-be-run',
        )
    eq(got, None)