]> diplodocus.org Git - nmh/blob - test/inc/test-pop
Added a FILE * to the m_getfld_state struct so that most
[nmh] / test / inc / test-pop
1 #!/bin/sh
2 ######################################################
3 #
4 # Test POP support in inc
5 # Only tests checking of local maildrop, does not
6 # test checking of POP server.
7 #
8 ######################################################
9
10 set -e
11
12 if test -z "${MH_OBJ_DIR}"; then
13 srcdir=`dirname $0`/../..
14 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 fi
16
17 . "$MH_OBJ_DIR/test/common.sh"
18
19 setup_test
20
21 #
22 # Some extra stuff we need for POP support
23 #
24
25 TESTUSER=testuser
26 TESTPASS=testuserpass
27 testport=65413
28
29 HOME="${MH_TEST_DIR}"; export HOME
30 echo "default login ${TESTUSER} password ${TESTPASS}" > ${HOME}/.netrc
31 chmod 600 ${HOME}/.netrc
32
33 expected=$MH_TEST_DIR/$$.expected
34 expected_err=$MH_TEST_DIR/$$.expected_err
35 actual=$MH_TEST_DIR/$$.actual
36 actual_err=$MH_TEST_DIR/$$.actual_err
37 testmessage=$MH_TEST_DIR/testmessage
38
39 cat > $testmessage <<EOM
40 Received: From somewhere
41 From: No Such User <nosuch@example.com>
42 To: Some Other User <someother@example.com>
43 Subject: Hello
44 Date: Sun, 17 Dec 2006 12:13:14 -0500
45
46 Hey man, how's it going?
47 .
48 Hope you're doing better.
49 EOM
50
51 pid=`"${MH_OBJ_DIR}/test/fakepop" "$testmessage" "$testport" \
52 "$TESTUSER" "$TESTPASS"`
53
54 run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80" \
55 "Incorporating new mail into inbox...
56
57 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
58 check $testmessage `mhpath +inbox 11` 'keep first'
59
60 # check -pack
61 pid=`"${MH_OBJ_DIR}/test/fakepop" "$testmessage" "$testport" \
62 "$TESTUSER" "$TESTPASS"`
63
64 touch "$MH_TEST_DIR/inc.mbox"
65 run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80 \
66 -pack $MH_TEST_DIR/inc.mbox" \
67 "Incorporating new mail into (null)...
68
69 1 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
70 run_test "inc -file $MH_TEST_DIR/inc.mbox -truncate" \
71 "Incorporating new mail into inbox...
72
73 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
74
75 check $testmessage `mhpath +inbox 11`
76 rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map"
77
78 exit ${failed:-0}