Fix Postfixadmin alias updating (don't leave commas at the start/end).
[mailshears.git] / test / test_rm.rb
index 1d424619b76561c054ccd34f86679ab672d19036..210ca5daa8cfb2485a1bed7a9ec8d00d415d12f0 100644 (file)
@@ -62,14 +62,17 @@ class TestRm < MailshearsTest
 
     actual = pfarm.list_aliases()
     expected = [{'address' => 'alice@example.com',
-                    'goto' => 'alice@example.com'},
-                {'address' => 'bob@example.com',
-                    'goto' => 'bob@example.com'},
+                 'goto' => 'alice@example.com,' +
+                           'bob@example.com,' +
+                           'carol@example.net'},
                 {'address' => 'beth@example.net',
-                    'goto' => 'beth@example.net'},
+                 'goto' => 'beth@example.net'},
+                {'address' => 'bob@example.com',
+                 'goto' => 'bob@example.com'},
                 {'address' => 'carol@example.net',
-                    'goto' => 'carol@example.net'}]
-    assert_equal(expected, actual)
+                 'goto' => 'carol@example.net'}]
+    expected.each { |e| assert(actual.include?(e)) } # can't sort dicts
+    actual.each { |a| assert(expected.include?(a)) } # can't sort dicts
 
     rrm = RoundcubeRm.new(cfg)
     actual = rrm.list_users()
@@ -130,10 +133,11 @@ class TestRm < MailshearsTest
 
     actual = pfarm.list_aliases()
     expected = [{'address' => 'alice@example.com',
-                    'goto' => 'alice@example.com'},
+                 'goto' => 'alice@example.com,bob@example.com'},
                 {'address' => 'bob@example.com',
-                    'goto' => 'bob@example.com'}]
-    assert_equal(expected, actual)
+                 'goto' => 'bob@example.com'}]
+    expected.each { |e| assert(actual.include?(e)) } # can't sort dicts
+    actual.each { |a| assert(expected.include?(a)) } # can't sort dicts
 
     rrm = RoundcubeRm.new(cfg)
     actual = rrm.list_users()