activesambaldap 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.en +6 -1
- data/NEWS.ja +6 -1
- data/README.en +3 -2
- data/README.ja +3 -2
- data/Rakefile +21 -2
- data/bin/asl-groupadd +0 -0
- data/bin/asl-groupadd.help +15 -0
- data/bin/asl-groupdel +0 -0
- data/bin/asl-groupdel.help +12 -0
- data/bin/asl-groupmod +0 -0
- data/bin/asl-groupmod.help +18 -0
- data/bin/asl-groupshow +0 -0
- data/bin/asl-groupshow.help +10 -0
- data/bin/asl-passwd +0 -0
- data/bin/asl-passwd.help +14 -0
- data/bin/asl-populate +0 -0
- data/bin/asl-populate.help +27 -0
- data/bin/asl-purge +0 -0
- data/bin/asl-purge.help +10 -0
- data/bin/asl-samba-computeradd +0 -0
- data/bin/asl-samba-computeradd.help +12 -0
- data/bin/asl-samba-groupadd +0 -0
- data/bin/asl-samba-groupadd.help +10 -0
- data/bin/asl-samba-groupdel +0 -0
- data/bin/asl-samba-groupdel.help +10 -0
- data/bin/asl-samba-groupmod +0 -0
- data/bin/asl-samba-groupmod.help +14 -0
- data/bin/asl-samba-useradd +0 -0
- data/bin/asl-samba-useradd.help +12 -0
- data/bin/asl-samba-userdel +0 -0
- data/bin/asl-samba-userdel.help +10 -0
- data/bin/asl-samba-usermod +0 -0
- data/bin/asl-samba-usermod.help +14 -0
- data/bin/asl-useradd +0 -0
- data/bin/asl-useradd.help +47 -0
- data/bin/asl-userdel +0 -0
- data/bin/asl-userdel.help +17 -0
- data/bin/asl-usermod +0 -0
- data/bin/asl-usermod.help +45 -0
- data/bin/asl-usershow +0 -0
- data/bin/asl-usershow.help +10 -0
- data/lib/active_samba_ldap.rb +9 -3
- data/lib/active_samba_ldap/account_entry.rb +1 -1
- data/lib/active_samba_ldap/group_entry.rb +3 -5
- data/lib/active_samba_ldap/reloadable.rb +2 -0
- data/lib/active_samba_ldap/samba_group_entry.rb +1 -1
- data/lib/active_samba_ldap/version.rb +1 -1
- data/misc/rd2html.rb +1 -1
- data/rails/plugin/active_samba_ldap/init.rb +15 -0
- data/test-unit/History.txt +32 -0
- data/test-unit/README.txt +32 -0
- data/test-unit/Rakefile +22 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/lib/test/unit.rb +280 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +14 -0
- data/test-unit/lib/test/unit/assertions.rb +722 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +250 -0
- data/test-unit/lib/test/unit/collector.rb +43 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +135 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color.rb +61 -0
- data/test-unit/lib/test/unit/diff.rb +524 -0
- data/test-unit/lib/test/unit/error.rb +124 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +110 -0
- data/test-unit/lib/test/unit/fixture.rb +185 -0
- data/test-unit/lib/test/unit/notification.rb +116 -0
- data/test-unit/lib/test/unit/omission.rb +129 -0
- data/test-unit/lib/test/unit/pending.rb +130 -0
- data/test-unit/lib/test/unit/priority.rb +146 -0
- data/test-unit/lib/test/unit/runner/console.rb +46 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +174 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +195 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +20 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/tc_adder.rb +18 -0
- data/test-unit/sample/tc_subtracter.rb +18 -0
- data/test-unit/sample/ts_examples.rb +7 -0
- data/test-unit/test/collector/test_descendant.rb +135 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_load.rb +333 -0
- data/test-unit/test/collector/test_objectspace.rb +98 -0
- data/test-unit/test/run-test.rb +13 -0
- data/test-unit/test/test_assertions.rb +693 -0
- data/test-unit/test/test_attribute.rb +86 -0
- data/test-unit/test/test_color.rb +37 -0
- data/test-unit/test/test_diff.rb +477 -0
- data/test-unit/test/test_emacs_runner.rb +60 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_fixture.rb +275 -0
- data/test-unit/test/test_notification.rb +33 -0
- data/test-unit/test/test_omission.rb +81 -0
- data/test-unit/test/test_pending.rb +64 -0
- data/test-unit/test/test_priority.rb +89 -0
- data/test-unit/test/test_testcase.rb +411 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit_test_util.rb +12 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/asl-test-utils.rb +0 -1
- data/test/run-test.rb +8 -12
- data/test/test_asl_groupmod.rb +3 -1
- data/test/test_asl_useradd.rb +3 -3
- data/test/test_samba_encrypt.rb +0 -1
- metadata +225 -88
- data/po/active-samba-ldap.pot +0 -459
- data/test/test-unit-ext.rb +0 -4
- data/test/test-unit-ext/always-show-result.rb +0 -28
- data/test/test-unit-ext/backtrace-filter.rb +0 -17
- data/test/test-unit-ext/long-display-for-emacs.rb +0 -25
- data/test/test-unit-ext/priority.rb +0 -186
@@ -0,0 +1,46 @@
|
|
1
|
+
module Test
|
2
|
+
module Unit
|
3
|
+
AutoRunner.register_runner(:console) do |auto_runner|
|
4
|
+
require 'test/unit/ui/console/testrunner'
|
5
|
+
Test::Unit::UI::Console::TestRunner
|
6
|
+
end
|
7
|
+
|
8
|
+
AutoRunner.setup_option do |auto_runner, opts|
|
9
|
+
require 'test/unit/ui/console/outputlevel'
|
10
|
+
|
11
|
+
output_levels = [
|
12
|
+
[:silent, UI::Console::OutputLevel::SILENT],
|
13
|
+
[:progress, UI::Console::OutputLevel::PROGRESS_ONLY],
|
14
|
+
[:normal, UI::Console::OutputLevel::NORMAL],
|
15
|
+
[:verbose, UI::Console::OutputLevel::VERBOSE],
|
16
|
+
]
|
17
|
+
opts.on('-v', '--verbose=[LEVEL]', output_levels,
|
18
|
+
"Set the output level (default is verbose).",
|
19
|
+
"(#{auto_runner.keyword_display(output_levels)})") do |level|
|
20
|
+
level ||= output_levels.assoc(:verbose)[1]
|
21
|
+
auto_runner.runner_options[:output_level] = level
|
22
|
+
end
|
23
|
+
|
24
|
+
use_color_options = [
|
25
|
+
[:auto, :auto],
|
26
|
+
["-", false],
|
27
|
+
["no", false],
|
28
|
+
["false", false],
|
29
|
+
["+", true],
|
30
|
+
["yes", true],
|
31
|
+
["true", true],
|
32
|
+
]
|
33
|
+
opts.on("--[no-]use-color=[auto]", use_color_options,
|
34
|
+
"Use color output",
|
35
|
+
"(default is auto") do |use_color|
|
36
|
+
case use_color
|
37
|
+
when nil
|
38
|
+
use_color = true
|
39
|
+
when :auto
|
40
|
+
use_color = nil
|
41
|
+
end
|
42
|
+
auto_runner.runner_options[:use_color] = use_color
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# Author:: Nathaniel Talbott.
|
4
|
+
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
5
|
+
# License:: Ruby license.
|
6
|
+
|
7
|
+
require 'test/unit/attribute'
|
8
|
+
require 'test/unit/fixture'
|
9
|
+
require 'test/unit/exceptionhandler'
|
10
|
+
require 'test/unit/assertions'
|
11
|
+
require 'test/unit/failure'
|
12
|
+
require 'test/unit/error'
|
13
|
+
require 'test/unit/pending'
|
14
|
+
require 'test/unit/omission'
|
15
|
+
require 'test/unit/notification'
|
16
|
+
require 'test/unit/priority'
|
17
|
+
require 'test/unit/testsuite'
|
18
|
+
require 'test/unit/assertionfailederror'
|
19
|
+
require 'test/unit/util/backtracefilter'
|
20
|
+
|
21
|
+
module Test
|
22
|
+
module Unit
|
23
|
+
|
24
|
+
# Ties everything together. If you subclass and add your own
|
25
|
+
# test methods, it takes care of making them into tests and
|
26
|
+
# wrapping those tests into a suite. It also does the
|
27
|
+
# nitty-gritty of actually running an individual test and
|
28
|
+
# collecting its results into a Test::Unit::TestResult object.
|
29
|
+
class TestCase
|
30
|
+
include Attribute
|
31
|
+
include Fixture
|
32
|
+
include ExceptionHandler
|
33
|
+
include ErrorHandler
|
34
|
+
include FailureHandler
|
35
|
+
include TestCasePendingSupport
|
36
|
+
include TestCaseOmissionSupport
|
37
|
+
include TestCaseNotificationSupport
|
38
|
+
include Priority
|
39
|
+
include Assertions
|
40
|
+
include Util::BacktraceFilter
|
41
|
+
|
42
|
+
STARTED = name + "::STARTED"
|
43
|
+
FINISHED = name + "::FINISHED"
|
44
|
+
|
45
|
+
DESCENDANTS = []
|
46
|
+
|
47
|
+
class << self
|
48
|
+
def inherited(sub_class)
|
49
|
+
DESCENDANTS << sub_class
|
50
|
+
end
|
51
|
+
|
52
|
+
# Rolls up all of the test* methods in the fixture into
|
53
|
+
# one suite, creating a new instance of the fixture for
|
54
|
+
# each method.
|
55
|
+
def suite
|
56
|
+
method_names = public_instance_methods(true).collect {|name| name.to_s}
|
57
|
+
tests = method_names.delete_if {|method_name| method_name !~ /^test./}
|
58
|
+
suite = TestSuite.new(name, self)
|
59
|
+
tests.sort.each do |test|
|
60
|
+
catch(:invalid_test) do
|
61
|
+
suite << new(test)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
if suite.empty?
|
65
|
+
catch(:invalid_test) do
|
66
|
+
suite << new("default_test")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
suite
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
attr_reader :method_name
|
74
|
+
|
75
|
+
# Creates a new instance of the fixture for running the
|
76
|
+
# test represented by test_method_name.
|
77
|
+
def initialize(test_method_name)
|
78
|
+
throw :invalid_test unless respond_to?(test_method_name)
|
79
|
+
throw :invalid_test if method(test_method_name).arity > 0
|
80
|
+
@method_name = test_method_name
|
81
|
+
@test_passed = true
|
82
|
+
end
|
83
|
+
|
84
|
+
# Runs the individual test method represented by this
|
85
|
+
# instance of the fixture, collecting statistics, failures
|
86
|
+
# and errors in result.
|
87
|
+
def run(result)
|
88
|
+
begin
|
89
|
+
@_result = result
|
90
|
+
yield(STARTED, name)
|
91
|
+
begin
|
92
|
+
run_setup
|
93
|
+
__send__(@method_name)
|
94
|
+
rescue Exception
|
95
|
+
raise unless handle_exception($!)
|
96
|
+
ensure
|
97
|
+
begin
|
98
|
+
run_teardown
|
99
|
+
rescue Exception
|
100
|
+
raise unless handle_exception($!)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
result.add_run
|
104
|
+
yield(FINISHED, name)
|
105
|
+
ensure
|
106
|
+
@_result = nil
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Called before every test method runs. Can be used
|
111
|
+
# to set up fixture information.
|
112
|
+
def setup
|
113
|
+
end
|
114
|
+
|
115
|
+
# Called after every test method runs. Can be used to tear
|
116
|
+
# down fixture information.
|
117
|
+
def teardown
|
118
|
+
end
|
119
|
+
|
120
|
+
def default_test
|
121
|
+
flunk("No tests were specified")
|
122
|
+
end
|
123
|
+
|
124
|
+
def size
|
125
|
+
1
|
126
|
+
end
|
127
|
+
|
128
|
+
# Returns a human-readable name for the specific test that
|
129
|
+
# this instance of TestCase represents.
|
130
|
+
def name
|
131
|
+
"#{@method_name}(#{self.class.name})"
|
132
|
+
end
|
133
|
+
|
134
|
+
# Overridden to return #name.
|
135
|
+
def to_s
|
136
|
+
name
|
137
|
+
end
|
138
|
+
|
139
|
+
# It's handy to be able to compare TestCase instances.
|
140
|
+
def ==(other)
|
141
|
+
return false unless(other.kind_of?(self.class))
|
142
|
+
return false unless(@method_name == other.method_name)
|
143
|
+
self.class == other.class
|
144
|
+
end
|
145
|
+
|
146
|
+
private
|
147
|
+
def current_result
|
148
|
+
@_result
|
149
|
+
end
|
150
|
+
|
151
|
+
def handle_exception(exception)
|
152
|
+
self.class.exception_handlers.each do |handler|
|
153
|
+
return true if send(handler, exception)
|
154
|
+
end
|
155
|
+
false
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns whether this individual test passed or
|
159
|
+
# not. Primarily for use in teardown so that artifacts
|
160
|
+
# can be left behind if the test fails.
|
161
|
+
def passed?
|
162
|
+
@test_passed
|
163
|
+
end
|
164
|
+
|
165
|
+
def problem_occurred
|
166
|
+
@test_passed = false
|
167
|
+
end
|
168
|
+
|
169
|
+
def add_assertion
|
170
|
+
current_result.add_assertion
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#--
|
2
|
+
# Author:: Nathaniel Talbott.
|
3
|
+
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
4
|
+
# License:: Ruby license.
|
5
|
+
|
6
|
+
require 'test/unit/util/observable'
|
7
|
+
require 'test/unit/failure'
|
8
|
+
require 'test/unit/error'
|
9
|
+
require 'test/unit/omission'
|
10
|
+
require 'test/unit/pending'
|
11
|
+
require 'test/unit/notification'
|
12
|
+
|
13
|
+
module Test
|
14
|
+
module Unit
|
15
|
+
module NullResultContainerInitializer
|
16
|
+
private
|
17
|
+
def initialize_containers
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Collects Test::Unit::Failure and Test::Unit::Error so that
|
22
|
+
# they can be displayed to the user. To this end, observers
|
23
|
+
# can be added to it, allowing the dynamic updating of, say, a
|
24
|
+
# UI.
|
25
|
+
class TestResult
|
26
|
+
include Util::Observable
|
27
|
+
include NullResultContainerInitializer
|
28
|
+
include TestResultFailureSupport
|
29
|
+
include TestResultErrorSupport
|
30
|
+
include TestResultPendingSupport
|
31
|
+
include TestResultOmissionSupport
|
32
|
+
include TestResultNotificationSupport
|
33
|
+
|
34
|
+
CHANGED = "CHANGED"
|
35
|
+
FAULT = "FAULT"
|
36
|
+
|
37
|
+
attr_reader :run_count, :assertion_count, :faults
|
38
|
+
|
39
|
+
# Constructs a new, empty TestResult.
|
40
|
+
def initialize
|
41
|
+
@run_count, @assertion_count = 0, 0
|
42
|
+
@summary_generators = []
|
43
|
+
@problem_checkers = []
|
44
|
+
@faults = []
|
45
|
+
initialize_containers
|
46
|
+
end
|
47
|
+
|
48
|
+
# Records a test run.
|
49
|
+
def add_run
|
50
|
+
@run_count += 1
|
51
|
+
notify_changed
|
52
|
+
end
|
53
|
+
|
54
|
+
# Records an individual assertion.
|
55
|
+
def add_assertion
|
56
|
+
@assertion_count += 1
|
57
|
+
notify_changed
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns a string contain the recorded runs, assertions,
|
61
|
+
# failures and errors in this TestResult.
|
62
|
+
def summary
|
63
|
+
["#{run_count} tests",
|
64
|
+
"#{assertion_count} assertions",
|
65
|
+
*@summary_generators.collect {|generator| send(generator)}].join(", ")
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_s
|
69
|
+
summary
|
70
|
+
end
|
71
|
+
|
72
|
+
# Returns whether or not this TestResult represents
|
73
|
+
# successful completion.
|
74
|
+
def passed?
|
75
|
+
@problem_checkers.all? {|checker| not send(checker)}
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
def notify_changed
|
80
|
+
notify_listeners(CHANGED, self)
|
81
|
+
end
|
82
|
+
|
83
|
+
def notify_fault(fault)
|
84
|
+
@faults << fault
|
85
|
+
notify_listeners(FAULT, fault)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# Author:: Nathaniel Talbott.
|
4
|
+
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
5
|
+
# License:: Ruby license.
|
6
|
+
|
7
|
+
require 'test/unit/error'
|
8
|
+
|
9
|
+
module Test
|
10
|
+
module Unit
|
11
|
+
|
12
|
+
# A collection of tests which can be #run.
|
13
|
+
#
|
14
|
+
# Note: It is easy to confuse a TestSuite instance with
|
15
|
+
# something that has a static suite method; I know because _I_
|
16
|
+
# have trouble keeping them straight. Think of something that
|
17
|
+
# has a suite method as simply providing a way to get a
|
18
|
+
# meaningful TestSuite instance.
|
19
|
+
class TestSuite
|
20
|
+
attr_reader :name, :tests
|
21
|
+
|
22
|
+
STARTED = name + "::STARTED"
|
23
|
+
FINISHED = name + "::FINISHED"
|
24
|
+
|
25
|
+
# Creates a new TestSuite with the given name.
|
26
|
+
def initialize(name="Unnamed TestSuite", test_case=nil)
|
27
|
+
@name = name
|
28
|
+
@tests = []
|
29
|
+
@test_case = test_case
|
30
|
+
end
|
31
|
+
|
32
|
+
# Runs the tests and/or suites contained in this
|
33
|
+
# TestSuite.
|
34
|
+
def run(result, &progress_block)
|
35
|
+
yield(STARTED, name)
|
36
|
+
run_startup(result)
|
37
|
+
@tests.each do |test|
|
38
|
+
test.run(result, &progress_block)
|
39
|
+
end
|
40
|
+
run_shutdown(result)
|
41
|
+
yield(FINISHED, name)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Adds the test to the suite.
|
45
|
+
def <<(test)
|
46
|
+
@tests << test
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
def delete(test)
|
51
|
+
@tests.delete(test)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Retuns the rolled up number of tests in this suite;
|
55
|
+
# i.e. if the suite contains other suites, it counts the
|
56
|
+
# tests within those suites, not the suites themselves.
|
57
|
+
def size
|
58
|
+
total_size = 0
|
59
|
+
@tests.each { |test| total_size += test.size }
|
60
|
+
total_size
|
61
|
+
end
|
62
|
+
|
63
|
+
def empty?
|
64
|
+
tests.empty?
|
65
|
+
end
|
66
|
+
|
67
|
+
# Overridden to return the name given the suite at
|
68
|
+
# creation.
|
69
|
+
def to_s
|
70
|
+
@name
|
71
|
+
end
|
72
|
+
|
73
|
+
# It's handy to be able to compare TestSuite instances.
|
74
|
+
def ==(other)
|
75
|
+
return false unless(other.kind_of?(self.class))
|
76
|
+
return false unless(@name == other.name)
|
77
|
+
@tests == other.tests
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
def run_startup(result)
|
82
|
+
return if @test_case.nil? or !@test_case.respond_to?(:startup)
|
83
|
+
begin
|
84
|
+
@test_case.startup
|
85
|
+
rescue Exception
|
86
|
+
raise unless handle_exception($!, result)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def run_shutdown(result)
|
91
|
+
return if @test_case.nil? or !@test_case.respond_to?(:shutdown)
|
92
|
+
begin
|
93
|
+
@test_case.shutdown
|
94
|
+
rescue Exception
|
95
|
+
raise unless handle_exception($!, result)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def handle_exception(exception, result)
|
100
|
+
case exception
|
101
|
+
when *ErrorHandler::PASS_THROUGH_EXCEPTIONS
|
102
|
+
false
|
103
|
+
else
|
104
|
+
result.add_error(Error.new(@test_case.name, exception))
|
105
|
+
true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|