File: testmail

package info (click to toggle)
getmail6 6.19.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,124 kB
  • sloc: python: 6,634; sh: 897; makefile: 73
file content (47 lines) | stat: -rwxr-xr-x 1,261 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh

set -efux

if [ -z "$AUTOPKGTEST_TMP" ]; then
    AUTOPKGTEST_TMP=tmp
    mkdir -p ${AUTOPKGTEST_TMP}
fi

SRCDIR=$(pwd)

cp -rv ${SRCDIR}/debian/tests ${AUTOPKGTEST_TMP}
cd ${AUTOPKGTEST_TMP}/tests

user_login=""

./user.py > user.log
while read pass login; do
	user_login=$login
	sed -e "s/login/$login/" -e "s/PASSW/$pass/" getmailrc > /home/${user_login}/getmailrc.test
done < user.log
chown ${user_login}:${user_login} /home/${user_login}/getmailrc.test
#start dovecot if its not running
if [ ! -f /run/dovecot/master.pid ]; then
    dovecot
fi
sleep 5
# wait for dovecot to start running
for i in `seq 1 5`; do
	doveadm -f flow instance list | grep -q 'running=yes'
	if [ $? -eq 0 ]; then
		break
	fi
	sleep 5
done
echo "this is test mail to test getmail" | mail -s "testmail" ${user_login}
echo "this is another test mail" | mail -s "second test" ${user_login}
sleep 1
su ${user_login} -c "mkdir -p ~/mailbox/cur && mkdir -p ~/mailbox/tmp && mkdir -p ~/mailbox/new"
su ${user_login} -c "getmail -r ~/getmailrc.test -g ~/ --dump"
su ${user_login} -c "getmail -r ~/getmailrc.test -g ~/"
for flname in `ls /home/${user_login}/mailbox/new`; do
	echo ""
        cat /home/${user_login}/mailbox/new/$flname
done
dovecot stop
userdel -f ${user_login}