]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - test/mailshears_test.rb
Fix broken nesting in lib/mv/plugins/postfixadmin.rb.
[mailshears.git] / test / mailshears_test.rb
index 483c587a08d0a7682de79def66096ccfe50d4dac..b4ba814f014e2dd83919f07200ac04dc1804fd18 100644 (file)
@@ -17,8 +17,7 @@ class MailshearsTest < MiniTest::Unit::TestCase
     # Check if the given mail directory of the form "example.com/user"
     # exists.
     cfg = configuration()
-    mail_root = cfg.send('mail_root')
-    return File.directory?("#{mail_root}/#{dir}")
+    return File.directory?("#{cfg.dovecot_mail_root()}/#{dir}")
   end
 
   def connect_superuser()
@@ -66,33 +65,39 @@ class MailshearsTest < MiniTest::Unit::TestCase
     #
     # 1. agendav_test
     #
-    #   +----------------------------+
-    #   |             prefs          |
-    #   +------------------+---------+
-    #   |  username        | options |
-    #   +------------------+---------+
-    #   | adam@example.net | herp    |
-    #   +------------------+---------+
+    #   +------------------------------+
+    #   |              prefs           |
+    #   +--------------------+---------+
+    #   |      username      | options |
+    #   +--------------------+---------+
+    #   |  adam@example.net  | herp    |
+    #   +--------------------+---------+
+    #   | booger@example.com | herp    |
+    #   +------------------  +---------+
     #
     #
-    #   +------------------------------------------------------+
-    #   |                        shared                        |
-    #   +-----+------------------+----------+------------------+
-    #   | sid |    user_from     | calendar |    user_which    |
-    #   +-----+------------------+----------+------------------+
-    #   |   1 | adam@example.net | derp     | beth@example.net |
-    #   +-----+------------------+----------+------------------+
+    #   +---------------------------------------------------------+
+    #   |                         shared                          |
+    #   +-----+--------------------+----------+-------------------+
+    #   | sid |     user_from      | calendar |    user_which     |
+    #   +-----+--------------------+----------+-------------------+
+    #   |   1 |  adam@example.net  | derp     | beth@example.net  |
+    #   +-----+--------------------+----------+-------------------+
+    #   |   2 | booger@example.com | derp     | carol@example.net |
+    #   +-----+--------------------+----------+-------------------+
     #
     #
     # 2. davical_test
     #
-    #   +-------------------------------------------------------+
-    #   |                        usr                            |
-    #   +---------+--------+----------------+-------------------+
-    #   | user_no | active |    joined      |     username      |
-    #   +---------+--------+----------------+-------------------+
-    #   |      17 | t      | 2014-01-04 ... | alice@example.com |
-    #   +---------+--------+----------------+-------------------+
+    #   +--------------------------------------------------------+
+    #   |                         usr                            |
+    #   +---------+--------+----------------+--------------------+
+    #   | user_no | active |    joined      |      username      |
+    #   +---------+--------+----------------+--------------------+
+    #   |      17 | t      | 2014-01-04 ... | alice@example.com  |
+    #   +---------+--------+----------------+--------------------+
+    #   |      18 | t      | 2014-01-04 ... | booger@example.com |
+    #   +---------+--------+----------------+--------------------+
     #
     #
     #   +-----------------------------------------+
@@ -102,6 +107,8 @@ class MailshearsTest < MiniTest::Unit::TestCase
     #   +---------+--------------+----------------+
     #   |      17 | dumb setting | its dumb value |
     #   +---------+--------------+----------------+
+    #   |      18 | dumb setting | its dumb value |
+    #   +---------+--------------+----------------+
     #
     #
     # 3. postfixadmin_test
@@ -166,22 +173,23 @@ class MailshearsTest < MiniTest::Unit::TestCase
     # 4. roundcube_test
     #
     #
-    #   +---------+-------------------+
-    #   | user_id |     username      |
-    #   +---------+-------------------+
-    #   |       1 | alice@example.com |
-    #   +---------+-------------------+
-    #   |       2 | adam@example.net  |
-    #   +---------+-------------------+
+    #   +---------+--------------------+
+    #   | user_id |     username       |
+    #   +---------+--------------------+
+    #   |       1 | alice@example.com  |
+    #   +---------+--------------------+
+    #   |       2 | booger@example.com |
+    #   +---------+--------------------+
+    #   |       3 | adam@example.net   |
+    #   +---------+--------------------+
 
     cfg = configuration()
 
     # First create the "mail directories".
-    mail_root = cfg.send('mail_root')
-    FileUtils.mkdir_p("#{mail_root}/example.com/alice")
-    FileUtils.mkdir_p("#{mail_root}/example.com/booger")
-    FileUtils.mkdir_p("#{mail_root}/example.com/jeremy")
-    FileUtils.mkdir_p("#{mail_root}/example.net/adam")
+    FileUtils.mkdir_p("#{cfg.dovecot_mail_root()}/example.com/alice")
+    FileUtils.mkdir_p("#{cfg.dovecot_mail_root()}/example.com/booger")
+    FileUtils.mkdir_p("#{cfg.dovecot_mail_root()}/example.com/jeremy")
+    FileUtils.mkdir_p("#{cfg.dovecot_mail_root()}/example.net/adam")
 
     # Now the databases and their content.
     connection = connect_superuser()
@@ -233,8 +241,7 @@ class MailshearsTest < MiniTest::Unit::TestCase
     connection.close()
 
     # Get rid of the maildirs.
-    mail_root = cfg.send('mail_root')
-    FileUtils.rm_r(mail_root)
+    FileUtils.rm_r(cfg.dovecot_mail_root())
   end
 
 end