aboutsummaryrefslogtreecommitdiffstats
path: root/tests/03-sync-mailbox-list-ref/run
blob: 3ead25dfb2fcc9cdedaf3e02c45ecec76da45642 (plain)
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
# Note: implementation-dependent as the reference name is not a level of
# mailbox hierarchy nor ends with the hierarchy delimiter
sed -ri 's#^\[local\]$#&\nlist-reference = foo#; s#^\[remote\]$#&\nlist-reference = bar#' \
    "$XDG_CONFIG_HOME/interimap/config"

# create a bunch of mailboxes in and out the respective list # references
doveadm -u "local"  mailbox create "foo" "foobar" "foo/bar/baz" "foo/baz" "bar"
doveadm -u "remote" mailbox create "foo"

# deliver somemessages to these mailboxes
for m in "foo" "foobar" "foo/bar/baz" "foo/baz" "bar"; do
    sample_message | deliver -u "local"  -- -m "$m"
done
sample_message | deliver -u "remote"  -- -m "foo"

interimap

# check that the mailbox lists match
diff -u --label="local/mailboxes" --label="remote/mailboxes" \
    <( doveadm -u "local"  mailbox list | sed -n "s/^foo//p" | sort ) \
    <( doveadm -u "remote" mailbox list | sed -n "s/^bar//p" | tr '\\' '/' | sort )

for m in "" "bar" "/bar/baz" "/baz"; do
    blob="x'$(printf "%s" "$m" | tr "/" "\\0" | xxd -c256 -ps)'"
    check_mailbox_status2 "$blob" "foo$m" "remote" "bar${m//\//\\}"
done

# vim: set filetype=sh :