From 25ce6f72160050d0d13531abb0158286ab093d14 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 4 Jan 2014 15:01:12 -0500 Subject: [PATCH 1/1] Add a real rm test. --- test/rm_account_test.rb | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/test/rm_account_test.rb b/test/rm_account_test.rb index e39ead5..bd0ac30 100644 --- a/test/rm_account_test.rb +++ b/test/rm_account_test.rb @@ -1,5 +1,6 @@ require 'pg' require 'test/unit' + require 'common/configuration' class RmAccountTest < Test::Unit::TestCase @@ -27,8 +28,35 @@ class RmAccountTest < Test::Unit::TestCase end - def test_dummy - assert(true) + def test_single_rm + cfg = Configuration.new(TESTCONF_PATH) + argv = ["adam@example.net"] + + # Load each of the plugins that we'll need. + cfg.plugins.each do |plugin_file| + require "rm/plugins/#{plugin_file}" + end + + # And the runners. + require "rm/rm_runner" + require "rm/rm_dummy_runner" + + require 'stringio' + output_buffer = StringIO.new() + + $stdout = output_buffer + plugin_class = RmPlugin.run(cfg, *argv) + $stdout = STDOUT + + actual = output_buffer.string() + + expected = "PostfixadminRm - Removed user: " + + "adam@example.net (adam@example.net)\n" + + "RoundcubeRm - Removed user: adam@example.net (User ID: 2)\n" + + "AgendavRm - Removed user: adam@example.net " + + "(Username: adam@example.net)\n" + + "DavicalRm - User not found: adam@example.net\n" + assert(actual == expected) end def setup -- 2.43.2