def test_walk_simple_cur(): tmp = maketemp() os.mkdir(os.path.join(tmp, 'new')) os.mkdir(os.path.join(tmp, 'cur')) writeFile( os.path.join(tmp, 'cur', '1202936960.V801I880d5M358047.foo:2,'), 'fake email', ) g = maildir.walk(tmp) eq(g.next(), os.path.join('cur', '1202936960.V801I880d5M358047.foo:2,')) assert_raises(StopIteration, g.next)
def test_fail(): tmp = maketemp() mockqsf = os.path.join(tmp, 'mock-qsf') writeFile( mockqsf, """\ #!/bin/sh exit 42 """) os.chmod(mockqsf, 0755) message = os.path.join(tmp, 'fake-email') writeFile( message, 'fake email', ) e = assert_raises( RuntimeError, spamminess.spamminess, path=message, _qsf=mockqsf, ) eq(str(e), 'qsf failed: 42')
def test_walk_empty(): tmp = maketemp() os.mkdir(os.path.join(tmp, 'new')) os.mkdir(os.path.join(tmp, 'cur')) g = maildir.walk(tmp) assert_raises(StopIteration, g.next)