From 342327326fc5203b34435a7291f5528f214c1717 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 4 Nov 2015 00:18:12 -0500 Subject: [PATCH] Add some new fixtures in preparation for prune tests. --- test/mailshears_test.rb | 70 +++++++++++++++++++-------------- test/sql/agendav-fixtures.sql | 5 +++ test/sql/davical-fixtures.sql | 7 ++++ test/sql/roundcube-fixtures.sql | 3 +- test/test_rm.rb | 14 +++---- 5 files changed, 61 insertions(+), 38 deletions(-) diff --git a/test/mailshears_test.rb b/test/mailshears_test.rb index aea8dfc..b4ba814 100644 --- a/test/mailshears_test.rb +++ b/test/mailshears_test.rb @@ -65,33 +65,39 @@ class MailshearsTest < MiniTest::Unit::TestCase # # 1. agendav_test # - # +----------------------------+ - # | prefs | - # +------------------+---------+ - # | username | options | - # +------------------+---------+ - # | adam@example.net | herp | - # +------------------+---------+ - # - # - # +------------------------------------------------------+ - # | shared | - # +-----+------------------+----------+------------------+ - # | sid | user_from | calendar | user_which | - # +-----+------------------+----------+------------------+ - # | 1 | adam@example.net | derp | beth@example.net | - # +-----+------------------+----------+------------------+ + # +------------------------------+ + # | 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 | + # +-----+--------------------+----------+-------------------+ + # | 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 | + # +---------+--------+----------------+--------------------+ # # # +-----------------------------------------+ @@ -101,6 +107,8 @@ class MailshearsTest < MiniTest::Unit::TestCase # +---------+--------------+----------------+ # | 17 | dumb setting | its dumb value | # +---------+--------------+----------------+ + # | 18 | dumb setting | its dumb value | + # +---------+--------------+----------------+ # # # 3. postfixadmin_test @@ -165,13 +173,15 @@ 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() diff --git a/test/sql/agendav-fixtures.sql b/test/sql/agendav-fixtures.sql index 76cdba1..780e062 100644 --- a/test/sql/agendav-fixtures.sql +++ b/test/sql/agendav-fixtures.sql @@ -2,3 +2,8 @@ INSERT INTO prefs (username, options) VALUES ('adam@example.net', 'herp'); INSERT INTO shared (user_from, user_which, calendar) VALUES ('adam@example.net', 'beth@example.net', 'derp'); + +/* Just kidding, here's another one! */ +INSERT INTO prefs (username, options) VALUES ('booger@example.com', 'herp'); +INSERT INTO shared (user_from, user_which, calendar) + VALUES ('booger@example.com', 'carol@example.net', 'derp'); diff --git a/test/sql/davical-fixtures.sql b/test/sql/davical-fixtures.sql index 5abf7a6..8b1f62c 100644 --- a/test/sql/davical-fixtures.sql +++ b/test/sql/davical-fixtures.sql @@ -14,3 +14,10 @@ INSERT INTO principal_type (principal_type_id, principal_type_desc) /* ...and assign it to the new user. */ INSERT INTO principal (type_id, user_no, displayname, default_privileges) VALUES (1, 17, 'Alice', '000000000001111000000000'); + +/* Now here's another user. */ +INSERT INTO usr (user_no, username) VALUES (18, 'booger@example.com'); +INSERT INTO usr_setting (user_no, setting_name, setting_value) + VALUES (18, 'dumb setting', 'its dumb value'); +INSERT INTO principal (type_id, user_no, displayname, default_privileges) + VALUES (1, 18, 'Booger', '000000000001111000000000'); diff --git a/test/sql/roundcube-fixtures.sql b/test/sql/roundcube-fixtures.sql index 6dc10cb..0965356 100644 --- a/test/sql/roundcube-fixtures.sql +++ b/test/sql/roundcube-fixtures.sql @@ -1,3 +1,4 @@ /* Create records for a subset of the five example.com/net users */ INSERT INTO users (username) VALUES ('alice@example.com'); -INSERT INTO users (username) VALUES ('adam@example.net') +INSERT INTO users (username) VALUES ('booger@example.com'); +INSERT INTO users (username) VALUES ('adam@example.net'); diff --git a/test/test_rm.rb b/test/test_rm.rb index f8e046f..1d42461 100644 --- a/test/test_rm.rb +++ b/test/test_rm.rb @@ -32,7 +32,7 @@ class TestRm < MailshearsTest "DovecotRm - Removed user adam@example.net " + "(#{cfg.dovecot_mail_root}/example.net/adam).\n" + "PostfixadminRm - Removed user adam@example.net.\n" + - "RoundcubeRm - Removed user adam@example.net (User ID: 2).\n" + "RoundcubeRm - Removed user adam@example.net (User ID: 3).\n" assert_equal(expected, actual) @@ -40,12 +40,12 @@ class TestRm < MailshearsTest arm = AgendavRm.new(cfg) actual = arm.list_users() - expected = [] + expected = [User.new('booger@example.com')] assert_equal(expected, actual) drm = DavicalRm.new(cfg) actual = drm.list_users() - expected = [User.new('alice@example.com')] + expected = [User.new('alice@example.com'), User.new('booger@example.com')] assert_equal(expected, actual) pfarm = PostfixadminRm.new(cfg) @@ -73,7 +73,7 @@ class TestRm < MailshearsTest rrm = RoundcubeRm.new(cfg) actual = rrm.list_users() - expected = [User.new('alice@example.com')] + expected = [User.new('alice@example.com'), User.new('booger@example.com')] assert_equal(expected, actual) # Check that adam's directory is gone but that the rest remain. @@ -110,12 +110,12 @@ class TestRm < MailshearsTest arm = AgendavRm.new(cfg) actual = arm.list_users() - expected = [] + expected = [User.new('booger@example.com')] assert_equal(expected, actual) drm = DavicalRm.new(cfg) actual = drm.list_users() - expected = [User.new('alice@example.com')] + expected = [User.new('alice@example.com'), User.new('booger@example.com')] assert_equal(expected, actual) pfarm = PostfixadminRm.new(cfg) @@ -137,7 +137,7 @@ class TestRm < MailshearsTest rrm = RoundcubeRm.new(cfg) actual = rrm.list_users() - expected = [User.new('alice@example.com')] + expected = [User.new('alice@example.com'), User.new('booger@example.com')] assert_equal(expected, actual) # Check that example.net's directory is gone but that the rest remain. -- 2.44.2