From: Michael Orlitzky Date: Sat, 4 Jan 2014 20:01:12 +0000 (-0500) Subject: Add a real rm test. X-Git-Tag: 0.0.1~64 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=commitdiff_plain;h=25ce6f72160050d0d13531abb0158286ab093d14 Add a real rm test. --- 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