about summary refs log tree commit homepage
path: root/xt
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-05-23 01:38:27 +0000
committerEric Wong <e@80x24.org>2021-05-23 19:35:06 +0000
commitec6d2dc31406378f77aa681017083fe8e98b4df9 (patch)
treecd28d18444ce44b438609bb305d8e4e3886fea61 /xt
parent22a88de70a33ab34b6dc52d8bf5fb8b4fa3ee66f (diff)
downloadpublic-inbox-ec6d2dc31406378f77aa681017083fe8e98b4df9.tar.gz
We support writing to IMAP stores in other places (just like
Maildir), and it's actually less complex for us to write to
IMAP.  Neither usability nor performance is ideal, but usability
will be addressed in the next commit to relax CLI argument
checking.

Performance is poor due to the synchronous Mail::IMAPClient
API and will need to be addressed with pipelining sometime
further in the future.
Diffstat (limited to 'xt')
-rw-r--r--xt/net_writer-imap.t18
1 files changed, 13 insertions, 5 deletions
diff --git a/xt/net_writer-imap.t b/xt/net_writer-imap.t
index 1298b958..0e6d4831 100644
--- a/xt/net_writer-imap.t
+++ b/xt/net_writer-imap.t
@@ -157,12 +157,20 @@ test_lei(sub {
 
         lei_ok qw(import -F eml), $f, \'import local copy w/o keywords';
 
+        lei_ok 'ls-mail-sync'; diag $lei_out;
+        lei_ok 'import', $$folder_uri; # populate mail_sync.sqlite3
+        lei_ok qw(tag +kw:seen +kw:answered +kw:flagged), $f;
+        lei_ok 'ls-mail-sync'; diag $lei_out;
+        chomp(my $uri_val = $lei_out);
+        lei_ok 'export-kw', $uri_val;
         $mic = $nwr->mic_for_folder($folder_uri);
-        # dummy set to ensure second set_kw clobbers
-        $nwr->imap_set_kw($mic, $uid[0], [ qw(seen answered flagged) ]
-                        )->expunge or BAIL_OUT "expunge $@";
-        $nwr->imap_set_kw($mic, $uid[0], [ 'seen' ]
-                        )->expunge or BAIL_OUT "expunge $@";
+        my $flags = $mic->flags($uid[0]);
+        is_deeply([sort @$flags], [ qw(\\Answered \\Flagged \\Seen) ],
+                'IMAP flags set by export-kw') or diag explain($flags);
+
+        # ensure this imap_set_kw clobbers
+        $nwr->imap_set_kw($mic, $uid[0], [ 'seen' ])->expunge or
+                BAIL_OUT "expunge $@";
         $mic = undef;
         @res = ();
         $nwr->imap_each($folder_uri, $imap_slurp_all, \@res);