activesambaldap 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/NEWS.en +6 -1
  2. data/NEWS.ja +6 -1
  3. data/README.en +3 -2
  4. data/README.ja +3 -2
  5. data/Rakefile +21 -2
  6. data/bin/asl-groupadd +0 -0
  7. data/bin/asl-groupadd.help +15 -0
  8. data/bin/asl-groupdel +0 -0
  9. data/bin/asl-groupdel.help +12 -0
  10. data/bin/asl-groupmod +0 -0
  11. data/bin/asl-groupmod.help +18 -0
  12. data/bin/asl-groupshow +0 -0
  13. data/bin/asl-groupshow.help +10 -0
  14. data/bin/asl-passwd +0 -0
  15. data/bin/asl-passwd.help +14 -0
  16. data/bin/asl-populate +0 -0
  17. data/bin/asl-populate.help +27 -0
  18. data/bin/asl-purge +0 -0
  19. data/bin/asl-purge.help +10 -0
  20. data/bin/asl-samba-computeradd +0 -0
  21. data/bin/asl-samba-computeradd.help +12 -0
  22. data/bin/asl-samba-groupadd +0 -0
  23. data/bin/asl-samba-groupadd.help +10 -0
  24. data/bin/asl-samba-groupdel +0 -0
  25. data/bin/asl-samba-groupdel.help +10 -0
  26. data/bin/asl-samba-groupmod +0 -0
  27. data/bin/asl-samba-groupmod.help +14 -0
  28. data/bin/asl-samba-useradd +0 -0
  29. data/bin/asl-samba-useradd.help +12 -0
  30. data/bin/asl-samba-userdel +0 -0
  31. data/bin/asl-samba-userdel.help +10 -0
  32. data/bin/asl-samba-usermod +0 -0
  33. data/bin/asl-samba-usermod.help +14 -0
  34. data/bin/asl-useradd +0 -0
  35. data/bin/asl-useradd.help +47 -0
  36. data/bin/asl-userdel +0 -0
  37. data/bin/asl-userdel.help +17 -0
  38. data/bin/asl-usermod +0 -0
  39. data/bin/asl-usermod.help +45 -0
  40. data/bin/asl-usershow +0 -0
  41. data/bin/asl-usershow.help +10 -0
  42. data/lib/active_samba_ldap.rb +9 -3
  43. data/lib/active_samba_ldap/account_entry.rb +1 -1
  44. data/lib/active_samba_ldap/group_entry.rb +3 -5
  45. data/lib/active_samba_ldap/reloadable.rb +2 -0
  46. data/lib/active_samba_ldap/samba_group_entry.rb +1 -1
  47. data/lib/active_samba_ldap/version.rb +1 -1
  48. data/misc/rd2html.rb +1 -1
  49. data/rails/plugin/active_samba_ldap/init.rb +15 -0
  50. data/test-unit/History.txt +32 -0
  51. data/test-unit/README.txt +32 -0
  52. data/test-unit/Rakefile +22 -0
  53. data/test-unit/bin/testrb +5 -0
  54. data/test-unit/lib/test/unit.rb +280 -0
  55. data/test-unit/lib/test/unit/assertionfailederror.rb +14 -0
  56. data/test-unit/lib/test/unit/assertions.rb +722 -0
  57. data/test-unit/lib/test/unit/attribute.rb +125 -0
  58. data/test-unit/lib/test/unit/autorunner.rb +250 -0
  59. data/test-unit/lib/test/unit/collector.rb +43 -0
  60. data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
  61. data/test-unit/lib/test/unit/collector/dir.rb +108 -0
  62. data/test-unit/lib/test/unit/collector/load.rb +135 -0
  63. data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
  64. data/test-unit/lib/test/unit/color.rb +61 -0
  65. data/test-unit/lib/test/unit/diff.rb +524 -0
  66. data/test-unit/lib/test/unit/error.rb +124 -0
  67. data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
  68. data/test-unit/lib/test/unit/failure.rb +110 -0
  69. data/test-unit/lib/test/unit/fixture.rb +185 -0
  70. data/test-unit/lib/test/unit/notification.rb +116 -0
  71. data/test-unit/lib/test/unit/omission.rb +129 -0
  72. data/test-unit/lib/test/unit/pending.rb +130 -0
  73. data/test-unit/lib/test/unit/priority.rb +146 -0
  74. data/test-unit/lib/test/unit/runner/console.rb +46 -0
  75. data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
  76. data/test-unit/lib/test/unit/testcase.rb +174 -0
  77. data/test-unit/lib/test/unit/testresult.rb +89 -0
  78. data/test-unit/lib/test/unit/testsuite.rb +110 -0
  79. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
  80. data/test-unit/lib/test/unit/ui/console/testrunner.rb +195 -0
  81. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +49 -0
  82. data/test-unit/lib/test/unit/ui/testrunner.rb +20 -0
  83. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
  84. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
  85. data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
  86. data/test-unit/lib/test/unit/util/observable.rb +90 -0
  87. data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
  88. data/test-unit/lib/test/unit/version.rb +7 -0
  89. data/test-unit/sample/adder.rb +13 -0
  90. data/test-unit/sample/subtracter.rb +12 -0
  91. data/test-unit/sample/tc_adder.rb +18 -0
  92. data/test-unit/sample/tc_subtracter.rb +18 -0
  93. data/test-unit/sample/ts_examples.rb +7 -0
  94. data/test-unit/test/collector/test_descendant.rb +135 -0
  95. data/test-unit/test/collector/test_dir.rb +406 -0
  96. data/test-unit/test/collector/test_load.rb +333 -0
  97. data/test-unit/test/collector/test_objectspace.rb +98 -0
  98. data/test-unit/test/run-test.rb +13 -0
  99. data/test-unit/test/test_assertions.rb +693 -0
  100. data/test-unit/test/test_attribute.rb +86 -0
  101. data/test-unit/test/test_color.rb +37 -0
  102. data/test-unit/test/test_diff.rb +477 -0
  103. data/test-unit/test/test_emacs_runner.rb +60 -0
  104. data/test-unit/test/test_error.rb +26 -0
  105. data/test-unit/test/test_failure.rb +33 -0
  106. data/test-unit/test/test_fixture.rb +275 -0
  107. data/test-unit/test/test_notification.rb +33 -0
  108. data/test-unit/test/test_omission.rb +81 -0
  109. data/test-unit/test/test_pending.rb +64 -0
  110. data/test-unit/test/test_priority.rb +89 -0
  111. data/test-unit/test/test_testcase.rb +411 -0
  112. data/test-unit/test/test_testresult.rb +113 -0
  113. data/test-unit/test/test_testsuite.rb +129 -0
  114. data/test-unit/test/testunit_test_util.rb +12 -0
  115. data/test-unit/test/ui/test_testrunmediator.rb +20 -0
  116. data/test-unit/test/util/test_backtracefilter.rb +41 -0
  117. data/test-unit/test/util/test_observable.rb +102 -0
  118. data/test-unit/test/util/test_procwrapper.rb +36 -0
  119. data/test/asl-test-utils.rb +0 -1
  120. data/test/run-test.rb +8 -12
  121. data/test/test_asl_groupmod.rb +3 -1
  122. data/test/test_asl_useradd.rb +3 -3
  123. data/test/test_samba_encrypt.rb +0 -1
  124. metadata +225 -88
  125. data/po/active-samba-ldap.pot +0 -459
  126. data/test/test-unit-ext.rb +0 -4
  127. data/test/test-unit-ext/always-show-result.rb +0 -28
  128. data/test/test-unit-ext/backtrace-filter.rb +0 -17
  129. data/test/test-unit-ext/long-display-for-emacs.rb +0 -25
  130. data/test/test-unit-ext/priority.rb +0 -186
@@ -0,0 +1,116 @@
1
+ require 'test/unit/util/backtracefilter'
2
+
3
+ module Test
4
+ module Unit
5
+ class Notification
6
+ include Util::BacktraceFilter
7
+ attr_reader :test_name, :location, :message
8
+
9
+ SINGLE_CHARACTER = 'N'
10
+ LABEL = "Notification"
11
+
12
+ # Creates a new Notification with the given location and
13
+ # message.
14
+ def initialize(test_name, location, message)
15
+ @test_name = test_name
16
+ @location = location
17
+ @message = message
18
+ end
19
+
20
+ # Returns a single character representation of a notification.
21
+ def single_character_display
22
+ SINGLE_CHARACTER
23
+ end
24
+
25
+ def label
26
+ LABEL
27
+ end
28
+
29
+ # Returns a brief version of the error description.
30
+ def short_display
31
+ "#{@test_name}: #{@message.split("\n")[0]}"
32
+ end
33
+
34
+ # Returns a verbose version of the error description.
35
+ def long_display
36
+ backtrace = filter_backtrace(location).join("\n")
37
+ "#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
38
+ end
39
+
40
+ # Overridden to return long_display.
41
+ def to_s
42
+ long_display
43
+ end
44
+ end
45
+
46
+ class NotifiedError < StandardError
47
+ end
48
+
49
+
50
+ module TestCaseNotificationSupport
51
+ class << self
52
+ def included(base)
53
+ base.class_eval do
54
+ include NotificationHandler
55
+ end
56
+ end
57
+ end
58
+
59
+ def notify(message, &block)
60
+ notification = Notification.new(name, filter_backtrace(caller), message)
61
+ add_notification(notification)
62
+ end
63
+
64
+ private
65
+ def add_notification(notification)
66
+ current_result.add_notification(notification)
67
+ end
68
+ end
69
+
70
+ module NotificationHandler
71
+ class << self
72
+ def included(base)
73
+ base.exception_handler(:handle_Notified_error)
74
+ end
75
+ end
76
+
77
+ private
78
+ def handle_Notified_error(exception)
79
+ return false unless exception.is_a?(NotifiedError)
80
+ notification = Notification.new(name,
81
+ filter_backtrace(exception.backtrace),
82
+ exception.message)
83
+ add_notification(notification)
84
+ true
85
+ end
86
+ end
87
+
88
+ module TestResultNotificationSupport
89
+ attr_reader :notifications
90
+
91
+ # Records a Test::Unit::Notification.
92
+ def add_notification(notification)
93
+ @notifications << notification
94
+ notify_fault(notification)
95
+ notify_changed
96
+ end
97
+
98
+ # Returns the number of notifications this TestResult has
99
+ # recorded.
100
+ def notification_count
101
+ @notifications.size
102
+ end
103
+
104
+ private
105
+ def initialize_containers
106
+ super
107
+ @notifications = []
108
+ @summary_generators << :notification_summary
109
+ end
110
+
111
+ def notification_summary
112
+ "#{notification_count} notifications"
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,129 @@
1
+ require 'test/unit/util/backtracefilter'
2
+
3
+ module Test
4
+ module Unit
5
+ class Omission
6
+ include Util::BacktraceFilter
7
+ attr_reader :test_name, :location, :message
8
+
9
+ SINGLE_CHARACTER = 'O'
10
+ LABEL = "Omission"
11
+
12
+ # Creates a new Omission with the given location and
13
+ # message.
14
+ def initialize(test_name, location, message)
15
+ @test_name = test_name
16
+ @location = location
17
+ @message = message
18
+ end
19
+
20
+ # Returns a single character representation of a omission.
21
+ def single_character_display
22
+ SINGLE_CHARACTER
23
+ end
24
+
25
+ def label
26
+ LABEL
27
+ end
28
+
29
+ # Returns a brief version of the error description.
30
+ def short_display
31
+ "#{@test_name}: #{@message.split("\n")[0]}"
32
+ end
33
+
34
+ # Returns a verbose version of the error description.
35
+ def long_display
36
+ backtrace = filter_backtrace(location).join("\n")
37
+ "#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
38
+ end
39
+
40
+ # Overridden to return long_display.
41
+ def to_s
42
+ long_display
43
+ end
44
+ end
45
+
46
+ class OmittedError < StandardError
47
+ end
48
+
49
+
50
+ module TestCaseOmissionSupport
51
+ class << self
52
+ def included(base)
53
+ base.class_eval do
54
+ include OmissionHandler
55
+ end
56
+ end
57
+ end
58
+
59
+ def omit(message=nil, &block)
60
+ message ||= "omitted."
61
+ if block_given?
62
+ omission = Omission.new(name, filter_backtrace(caller), message)
63
+ add_omission(omission)
64
+ else
65
+ raise OmittedError.new(message)
66
+ end
67
+ end
68
+
69
+ def omit_if(condition, *args, &block)
70
+ omit(*args, &block) if condition
71
+ end
72
+
73
+ def omit_unless(condition, *args, &block)
74
+ omit(*args, &block) unless condition
75
+ end
76
+
77
+ private
78
+ def add_omission(omission)
79
+ current_result.add_omission(omission)
80
+ end
81
+ end
82
+
83
+ module OmissionHandler
84
+ class << self
85
+ def included(base)
86
+ base.exception_handler(:handle_omitted_error)
87
+ end
88
+ end
89
+
90
+ private
91
+ def handle_omitted_error(exception)
92
+ return false unless exception.is_a?(OmittedError)
93
+ omission = Omission.new(name,
94
+ filter_backtrace(exception.backtrace),
95
+ exception.message)
96
+ add_omission(omission)
97
+ true
98
+ end
99
+ end
100
+
101
+ module TestResultOmissionSupport
102
+ attr_reader :omissions
103
+
104
+ # Records a Test::Unit::Omission.
105
+ def add_omission(omission)
106
+ @omissions << omission
107
+ notify_fault(omission)
108
+ notify_changed
109
+ end
110
+
111
+ # Returns the number of omissions this TestResult has
112
+ # recorded.
113
+ def omission_count
114
+ @omissions.size
115
+ end
116
+
117
+ private
118
+ def initialize_containers
119
+ super
120
+ @omissions = []
121
+ @summary_generators << :omission_summary
122
+ end
123
+
124
+ def omission_summary
125
+ "#{omission_count} omissions"
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,130 @@
1
+ require 'test/unit/util/backtracefilter'
2
+
3
+ module Test
4
+ module Unit
5
+ class Pending
6
+ include Util::BacktraceFilter
7
+ attr_reader :test_name, :location, :message
8
+
9
+ SINGLE_CHARACTER = 'P'
10
+ LABEL = "Pending"
11
+
12
+ # Creates a new Pending with the given location and
13
+ # message.
14
+ def initialize(test_name, location, message)
15
+ @test_name = test_name
16
+ @location = location
17
+ @message = message
18
+ end
19
+
20
+ # Returns a single character representation of a pending.
21
+ def single_character_display
22
+ SINGLE_CHARACTER
23
+ end
24
+
25
+ def label
26
+ LABEL
27
+ end
28
+
29
+ # Returns a brief version of the error description.
30
+ def short_display
31
+ "#{@test_name}: #{@message.split("\n")[0]}"
32
+ end
33
+
34
+ # Returns a verbose version of the error description.
35
+ def long_display
36
+ backtrace = filter_backtrace(location).join("\n")
37
+ "#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
38
+ end
39
+
40
+ # Overridden to return long_display.
41
+ def to_s
42
+ long_display
43
+ end
44
+ end
45
+
46
+ class PendedError < StandardError
47
+ end
48
+
49
+
50
+ module TestCasePendingSupport
51
+ class << self
52
+ def included(base)
53
+ base.class_eval do
54
+ include PendingHandler
55
+ end
56
+ end
57
+ end
58
+
59
+ def pend(message=nil, &block)
60
+ message ||= "pended."
61
+ if block_given?
62
+ pending = nil
63
+ begin
64
+ yield
65
+ rescue Exception
66
+ pending = Pending.new(name, filter_backtrace(caller), message)
67
+ add_pending(pending)
68
+ end
69
+ unless pending
70
+ flunk("Pending block should not be passed: #{message}")
71
+ end
72
+ else
73
+ raise PendedError.new(message)
74
+ end
75
+ end
76
+
77
+ private
78
+ def add_pending(pending)
79
+ problem_occurred
80
+ current_result.add_pending(pending)
81
+ end
82
+ end
83
+
84
+ module PendingHandler
85
+ class << self
86
+ def included(base)
87
+ base.exception_handler(:handle_pended_error)
88
+ end
89
+ end
90
+
91
+ private
92
+ def handle_pended_error(exception)
93
+ return false unless exception.is_a?(PendedError)
94
+ pending = Pending.new(name,
95
+ filter_backtrace(exception.backtrace),
96
+ exception.message)
97
+ add_pending(pending)
98
+ true
99
+ end
100
+ end
101
+
102
+ module TestResultPendingSupport
103
+ attr_reader :pendings
104
+
105
+ # Records a Test::Unit::Pending.
106
+ def add_pending(pending)
107
+ @pendings << pending
108
+ notify_fault(pending)
109
+ notify_changed
110
+ end
111
+
112
+ # Returns the number of pendings this TestResult has
113
+ # recorded.
114
+ def pending_count
115
+ @pendings.size
116
+ end
117
+
118
+ private
119
+ def initialize_containers
120
+ super
121
+ @pendings = []
122
+ @summary_generators << :pending_summary
123
+ end
124
+
125
+ def pending_summary
126
+ "#{pending_count} pendings"
127
+ end
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,146 @@
1
+ require "fileutils"
2
+ require "tmpdir"
3
+
4
+ module Test
5
+ module Unit
6
+ module Priority
7
+ class << self
8
+ def included(base)
9
+ base.extend(ClassMethods)
10
+
11
+ base.class_eval do
12
+ setup :priority_setup, :before => :prepend
13
+ teardown :priority_teardown, :after => :append
14
+ end
15
+ end
16
+ end
17
+
18
+ class Checker
19
+ class << self
20
+ def have_priority?(name)
21
+ singleton_class = (class << self; self; end)
22
+ singleton_class.method_defined?(priority_check_method_name(name))
23
+ end
24
+
25
+ def need_to_run?(test)
26
+ priority = test[:priority] || :normal
27
+ if have_priority?(priority)
28
+ send(priority_check_method_name(priority), test)
29
+ else
30
+ true
31
+ end
32
+ end
33
+
34
+ def run_priority_must?(test)
35
+ true
36
+ end
37
+
38
+ def run_priority_important?(test)
39
+ rand > 0.1
40
+ end
41
+
42
+ def run_priority_high?(test)
43
+ rand > 0.3
44
+ end
45
+
46
+ def run_priority_normal?(test)
47
+ rand > 0.5
48
+ end
49
+
50
+ def run_priority_low?(test)
51
+ rand > 0.75
52
+ end
53
+
54
+ def run_priority_never?(test)
55
+ false
56
+ end
57
+
58
+ private
59
+ def priority_check_method_name(priority_name)
60
+ "run_priority_#{priority_name}?"
61
+ end
62
+ end
63
+
64
+ attr_reader :test
65
+ def initialize(test)
66
+ @test = test
67
+ end
68
+
69
+ def setup
70
+ FileUtils.rm_f(passed_file)
71
+ end
72
+
73
+ def teardown
74
+ if @test.send(:passed?)
75
+ FileUtils.touch(passed_file)
76
+ else
77
+ FileUtils.rm_f(passed_file)
78
+ end
79
+ end
80
+
81
+ def need_to_run?
82
+ !previous_test_success? or self.class.need_to_run?(@test)
83
+ end
84
+
85
+ private
86
+ def previous_test_success?
87
+ File.exist?(passed_file)
88
+ end
89
+
90
+ def result_dir
91
+ components = [".test-result",
92
+ @test.class.name || "AnonymousTestCase",
93
+ @test.method_name.to_s]
94
+ parent_directories = [File.dirname($0), Dir.pwd]
95
+ if Process.respond_to?(:uid)
96
+ parent_directories << File.join(Dir.tmpdir, Process.uid.to_s)
97
+ end
98
+ parent_directories.each do |parent_directory|
99
+ dir = File.expand_path(File.join(parent_directory, *components))
100
+ begin
101
+ FileUtils.mkdir_p(dir)
102
+ return dir
103
+ rescue Errno::EACCES
104
+ end
105
+ end
106
+
107
+ raise Errno::EACCES, parent_directories.join(", ")
108
+ end
109
+
110
+ def passed_file
111
+ File.join(result_dir, "passed")
112
+ end
113
+
114
+ def escaped_method_name
115
+ @method_name.to_s.gsub(/[!?=]$/) do |matched|
116
+ case matched
117
+ when "!"
118
+ ".destructive"
119
+ when "?"
120
+ ".predicate"
121
+ when "="
122
+ ".equal"
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ module ClassMethods
129
+ def priority(name, *tests)
130
+ unless Checker.have_priority?(name)
131
+ raise ArgumentError, "unknown priority: #{name}"
132
+ end
133
+ attribute(:priority, name, {:keep => true}, *tests)
134
+ end
135
+ end
136
+
137
+ def priority_setup
138
+ Checker.new(self).setup
139
+ end
140
+
141
+ def priority_teardown
142
+ Checker.new(self).teardown
143
+ end
144
+ end
145
+ end
146
+ end