commit 3a7fdaed0c236188be4e85e90782e7b1962016ee
parent ffd3959caf7226d2ac188f83db819c63e753c3b6
Author: Dan Callaghan <djc@djc.id.au>
Date: Sat, 18 Jun 2022 18:00:13 +1000
tests: add coverage for sup-sync-back-maildir
Diffstat:
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/Manifest.txt b/Manifest.txt
@@ -133,6 +133,7 @@ test/gnupg_test_home/sup-test-2@foo.bar.asc
test/integration/test_maildir.rb
test/integration/test_mbox.rb
test/integration/test_sup-add.rb
+test/integration/test_sup-sync-back-maildir.rb
test/test_crypto.rb
test/test_header_parsing.rb
test/test_helper.rb
diff --git a/test/integration/test_sup-sync-back-maildir.rb b/test/integration/test_sup-sync-back-maildir.rb
@@ -0,0 +1,40 @@
+require "test_helper"
+
+class TestSupSyncBackMaildir < Minitest::Test
+
+ def setup
+ @path = Dir.mktmpdir
+
+ @maildir = File.join @path, "test_maildir"
+ Dir.mkdir @maildir
+ %w[cur new tmp].each do |subdir|
+ Dir.mkdir (File.join @maildir, subdir)
+ end
+ msg_path = File.join @maildir, "new", "123.hostname"
+ FileUtils.copy_file fixture_path("simple-message.eml"), msg_path
+
+ _out, _err = capture_subprocess_io do
+ assert system({"SUP_BASE" => @path}, "bin/sup-add", "maildir://#{@maildir}")
+ assert system({"SUP_BASE" => @path}, "bin/sup-sync")
+ end
+ end
+
+ def teardown
+ FileUtils.rm_r @path
+ end
+
+ def test_it_syncs_seen_unread_flags
+ _out, _err = capture_subprocess_io do
+ assert system({"SUP_BASE" => @path},
+ "bin/sup-tweak-labels",
+ "--all-sources",
+ "--add=replied",
+ "--remove=unread")
+ assert system({"SUP_BASE" => @path}, "bin/sup-sync-back-maildir", "--no-confirm")
+ end
+
+ refute File.exist? (File.join @maildir, "new", "123.hostname")
+ assert File.exist? (File.join @maildir, "cur", "123.hostname:2,RS")
+ end
+
+end