X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=test%2Fmailshears_test.rb;h=94f2f4903bd7894b505fa21e8a3ff340503ba668;hp=96a6e35e6c6ccf5343adca27d4a806031ce0ba33;hb=fa7782720ff15fce29b6f875678e9fd0c197485a;hpb=b947ef8844f090eedd50be0383abe417d910bb1a;ds=sidebyside diff --git a/test/mailshears_test.rb b/test/mailshears_test.rb index 96a6e35..94f2f49 100644 --- a/test/mailshears_test.rb +++ b/test/mailshears_test.rb @@ -1,9 +1,17 @@ +# Without this, I get... +# +# Warning: you should require 'minitest/autorun' instead. +# Warning: or add 'gem "minitest"' before 'require "minitest/autorun"' +# +# Whatever. +gem 'minitest' +require 'minitest/autorun' + require 'common/configuration' require 'fileutils' -require 'minitest/unit' require 'pg' -class MailshearsTest < MiniTest::Unit::TestCase +class MailshearsTest < MiniTest::Test # This is that class that most (if not all) of our test cases will # inherit. It provides the automatic setup and teardown of the # filesystem and database that the test cases will exercise. @@ -71,15 +79,15 @@ class MailshearsTest < MiniTest::Unit::TestCase # +------------------ +---------+ # # - # +---------------------------------------------------------+ - # | shared | - # +-----+--------------------+----------+-------------------+ - # | sid | user_from | calendar | user_which | - # +-----+--------------------+----------+-------------------+ - # | 1 | adam@example.net | derp | beth@example.net | - # +-----+--------------------+----------+-------------------+ - # | 2 | booger@example.com | derp | carol@example.net | - # +-----+--------------------+----------+-------------------+ + # +---------------------------------------------------------------------------------------------------------------------+ + # | shares | + # +-----+-----------------------------------+---------------------------------------------------+-----------------------+ + # | sid | owner | calendar | with | + # +-----+-----------------------------------+---------------------------------------------------+-----------------------+ + # | 1 | /caldav.php/adam%40example.net/ | /caldav.php/adam%40example.net/calendar-default | /beth%40example.net/ | + # +-----+-----------------------------------+---------------------------------------------------+-----------------------+ + # | 2 | /caldav.php/booger%40example.com/ | /caldav.php/booger%40example.com/calendar-default | /carol%40example.net/ | + # +-----+-----------------------------------+---------------------------------------------------+-----------------------+ # # # 2. davical_test @@ -138,21 +146,24 @@ class MailshearsTest < MiniTest::Unit::TestCase # +-------------------+-------------+------------+ # # - # +------------------------------------------------------+ - # | alias | - # +-------------------+-------------------+--------------+ - # | address | goto | domain | - # +-------------------+-------------------+--------------+ - # | alice@example.com | alice@example.com | example.com | - # +-------------------+-------------------+--------------+ - # | bob@example.com | bob@example.com | example.com | - # +-------------------+-------------------+--------------+ - # | adam@example.net | adam@example.net | example.net | - # +-------------------+-------------------+--------------+ - # | beth@example.net | beth@example.net | example.net | - # +-------------------+-------------------+--------------+ - # | carol@example.net | carol@example.net | example.net | - # +-------------------+-------------------+--------------+ + # +-------------------------------------------------------+ + # | alias | + # +-------------------+--------------------+--------------+ + # | address | goto | domain | + # +-------------------+--------------------+--------------+ + # | alice@example.com | alice@example.com, | example.com | + # | | adam@example.net, | | + # | | bob@example.com, | | + # | | carol@example.net | | + # +-------------------+--------------------+--------------+ + # | bob@example.com | bob@example.com | example.com | + # +-------------------+--------------------+--------------+ + # | adam@example.net | adam@example.net | example.net | + # +-------------------+--------------------+--------------+ + # | beth@example.net | beth@example.net | example.net | + # +-------------------+--------------------+--------------+ + # | carol@example.net | carol@example.net | example.net | + # +-------------------+--------------------+--------------+ # # # +---------------------------------+ @@ -197,7 +208,7 @@ class MailshearsTest < MiniTest::Unit::TestCase plugin_dbname = cfg.send("#{plugin}_dbname") next if plugin_dbname.nil? # Skip the dovecot plugin query = "CREATE DATABASE #{plugin_dbname};" - connection.query(query) + connection.sync_exec(query) plugin_dbhost = cfg.send("#{plugin}_dbhost") plugin_dbport = cfg.send("#{plugin}_dbport") @@ -212,9 +223,9 @@ class MailshearsTest < MiniTest::Unit::TestCase plugin_dbpass) sql = File.open("test/sql/#{plugin}.sql").read() - plugin_conn.query(sql) + plugin_conn.sync_exec(sql) sql = File.open("test/sql/#{plugin}-fixtures.sql").read() - plugin_conn.query(sql) + plugin_conn.sync_exec(sql) plugin_conn.close() end @@ -235,7 +246,7 @@ class MailshearsTest < MiniTest::Unit::TestCase plugin_dbname = cfg.send("#{plugin}_dbname") next if plugin_dbname.nil? # Skip the dovecot plugin query = "DROP DATABASE IF EXISTS #{plugin_dbname};" - connection.query(query) + connection.sync_exec(query) end connection.close()