sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/

test/integration/test_sup-sync-back-maildir.rb (1168B) - raw

      1 require "test_helper"
      2 
      3 class TestSupSyncBackMaildir < Minitest::Test
      4 
      5   def setup
      6     @path = Dir.mktmpdir
      7 
      8     @maildir = File.join @path, "test_maildir"
      9     Dir.mkdir @maildir
     10     %w[cur new tmp].each do |subdir|
     11       Dir.mkdir (File.join @maildir, subdir)
     12     end
     13     msg_path = File.join @maildir, "new", "123.hostname"
     14     FileUtils.copy_file fixture_path("simple-message.eml"), msg_path
     15 
     16     _out, _err = capture_subprocess_io do
     17       assert system({"SUP_BASE" => @path}, "bin/sup-add", "maildir://#{@maildir}")
     18       assert system({"SUP_BASE" => @path}, "bin/sup-sync")
     19     end
     20   end
     21 
     22   def teardown
     23     FileUtils.rm_r @path
     24   end
     25 
     26   def test_it_syncs_seen_unread_flags
     27     _out, _err = capture_subprocess_io do
     28       assert system({"SUP_BASE" => @path},
     29                     "bin/sup-tweak-labels",
     30                     "--all-sources",
     31                     "--add=replied",
     32                     "--remove=unread")
     33       assert system({"SUP_BASE" => @path}, "bin/sup-sync-back-maildir", "--no-confirm")
     34     end
     35 
     36     refute File.exist? (File.join @maildir, "new", "123.hostname")
     37     assert File.exist? (File.join @maildir, "cur", "123.hostname:2,RS")
     38   end
     39 
     40 end