require 'pg'
require 'test/unit'
+
require 'common/configuration'
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