]>
diplodocus.org Git - nmh/blob - test/inc/test-pop
2 ######################################################
4 # Test POP support in inc
5 # Only tests checking of local maildrop, does not
6 # test checking of POP server.
8 ######################################################
12 if test -z "${MH_OBJ_DIR}"; then
13 srcdir
=`dirname $0`/..
/..
14 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
17 .
"$MH_OBJ_DIR/test/common.sh"
22 # Some extra stuff we need for POP support
27 arith_eval
64001 + `id -u` % 1000
30 HOME
="${MH_TEST_DIR}"; export HOME
31 netrc
="${HOME}/.netrc"
32 echo "default login ${TESTUSER} password ${TESTPASS}" > "$netrc"
35 expected
=$MH_TEST_DIR/$$.expected
36 expected_err
=$MH_TEST_DIR/$$.expected_err
37 actual
=$MH_TEST_DIR/$$.actual
38 actual_err
=$MH_TEST_DIR/$$.actual_err
39 testmessage
=$MH_TEST_DIR/testmessage
41 cat > $testmessage <<EOM
42 Received: From somewhere
43 From: No Such User <nosuch@example.com>
44 To: Some Other User <someother@example.com>
46 Date: Sun, 17 Dec 2006 12:13:14 -0500
48 Hey man, how's it going?
50 Hope you're doing better.
53 pid
=`"${MH_OBJ_DIR}/test/fakepop" "$testmessage" "$testport" \
54 "$TESTUSER" "$TESTPASS"`
56 run_test
"inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80" \
57 "Incorporating new mail into inbox...
59 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
60 check
$testmessage `mhpath +inbox 11` 'keep first'
63 pid
=`"${MH_OBJ_DIR}/test/fakepop" "$testmessage" "$testport" \
64 "$TESTUSER" "$TESTPASS"`
66 touch "$MH_TEST_DIR/inc.mbox"
67 run_test
"inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80 \
68 -pack $MH_TEST_DIR/inc.mbox" \
69 "Incorporating new mail into (null)...
71 1 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
72 run_test
"inc -file $MH_TEST_DIR/inc.mbox -truncate -width 80" \
73 "Incorporating new mail into inbox...
75 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
77 check
$testmessage `mhpath +inbox 11` 'keep first'
78 rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map" "$netrc"
80 # check credentials: file
81 # Redirect stdin so that inc doesn't wait on the user if it can't
82 # read the netrc file, even though that shouldn't happen.
84 TESTPASS
=differentpass
86 netrc
="${HOME}/.mhnetrc"
87 echo "default login ${TESTUSER} password ${TESTPASS}" > "$netrc"
89 echo "credentials: file:${netrc}" >>$MH
91 pid
=`"${MH_OBJ_DIR}/test/fakepop" "$testmessage" "$testport" \
92 "$TESTUSER" "$TESTPASS"`
94 touch "$MH_TEST_DIR/inc.mbox"
95 run_test
"inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 65 \
96 -pack $MH_TEST_DIR/inc.mbox" \
97 "Incorporating new mail into (null)...
99 1 12/17 No Such User Hello<<Hey man, how's it going? ." </dev
/null
100 run_test
"inc -file $MH_TEST_DIR/inc.mbox -truncate -width 65" \
101 "Incorporating new mail into inbox...
103 11+ 12/17 No Such User Hello<<Hey man, how's it going? ." </dev
/null
105 check
$testmessage `mhpath +inbox 11`
106 rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map" "$netrc"