activeldap 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. data/CHANGES +34 -0
  2. data/README +13 -0
  3. data/Rakefile +2 -1
  4. data/TODO +6 -0
  5. data/benchmark/bench-al.rb +68 -17
  6. data/examples/al-admin/app/helpers/application_helper.rb +3 -5
  7. data/examples/al-admin/app/views/layouts/_footer.html.erb +2 -0
  8. data/examples/al-admin/config/boot.rb +7 -7
  9. data/examples/al-admin/config/environment.rb +27 -12
  10. data/examples/al-admin/config/environments/development.rb +0 -1
  11. data/examples/al-admin/config/environments/production.rb +6 -1
  12. data/examples/al-admin/config/environments/test.rb +1 -1
  13. data/examples/al-admin/config/initializers/gettext.rb +15 -1
  14. data/examples/al-admin/po/en/al-admin.po +1 -1
  15. data/examples/al-admin/po/ja/al-admin.po +1 -1
  16. data/examples/al-admin/po/nl/al-admin.po +1 -1
  17. data/examples/al-admin/public/dispatch.cgi +0 -0
  18. data/examples/al-admin/public/dispatch.fcgi +0 -0
  19. data/examples/al-admin/public/dispatch.rb +0 -0
  20. data/examples/al-admin/public/javascripts/controls.js +73 -73
  21. data/examples/al-admin/public/javascripts/dragdrop.js +166 -165
  22. data/examples/al-admin/public/javascripts/effects.js +174 -166
  23. data/examples/al-admin/public/javascripts/prototype.js +362 -267
  24. data/examples/al-admin/script/about +0 -0
  25. data/examples/al-admin/script/console +0 -0
  26. data/examples/al-admin/script/dbconsole +3 -0
  27. data/examples/al-admin/script/destroy +0 -0
  28. data/examples/al-admin/script/generate +0 -0
  29. data/examples/al-admin/script/performance/benchmarker +0 -0
  30. data/examples/al-admin/script/performance/profiler +0 -0
  31. data/examples/al-admin/script/performance/request +0 -0
  32. data/examples/al-admin/script/plugin +0 -0
  33. data/examples/al-admin/script/process/inspector +0 -0
  34. data/examples/al-admin/script/process/reaper +0 -0
  35. data/examples/al-admin/script/process/spawner +0 -0
  36. data/examples/al-admin/script/runner +0 -0
  37. data/examples/al-admin/script/server +0 -0
  38. data/examples/al-admin/test/run-test.sh +0 -0
  39. data/examples/groupadd +0 -0
  40. data/examples/groupdel +0 -0
  41. data/examples/groupls +0 -0
  42. data/examples/groupmod +0 -0
  43. data/examples/lpasswd +0 -0
  44. data/examples/ouadd +0 -0
  45. data/examples/useradd +0 -0
  46. data/examples/useradd-binary +0 -0
  47. data/examples/userdel +0 -0
  48. data/examples/userls +0 -0
  49. data/examples/usermod +0 -0
  50. data/examples/usermod-binary-add +0 -0
  51. data/examples/usermod-binary-add-time +0 -0
  52. data/examples/usermod-binary-del +0 -0
  53. data/examples/usermod-lang-add +0 -0
  54. data/lib/active_ldap.rb +10 -4
  55. data/lib/active_ldap/action_controller/ldap_benchmarking.rb +28 -9
  56. data/lib/active_ldap/adapter/base.rb +30 -17
  57. data/lib/active_ldap/adapter/jndi.rb +5 -1
  58. data/lib/active_ldap/adapter/ldap.rb +5 -1
  59. data/lib/active_ldap/association/has_many_utils.rb +7 -1
  60. data/lib/active_ldap/associations.rb +10 -5
  61. data/lib/active_ldap/attributes.rb +6 -1
  62. data/lib/active_ldap/base.rb +154 -52
  63. data/lib/active_ldap/configuration.rb +1 -1
  64. data/lib/active_ldap/connection.rb +7 -4
  65. data/lib/active_ldap/get_text.rb +11 -3
  66. data/lib/active_ldap/ldif.rb +16 -4
  67. data/lib/active_ldap/operations.rb +13 -5
  68. data/lib/active_ldap/schema.rb +6 -2
  69. data/lib/active_ldap/schema/syntaxes.rb +15 -3
  70. data/lib/active_ldap/user_password.rb +4 -4
  71. data/lib/active_ldap/validations.rb +32 -44
  72. data/lib/active_ldap/xml.rb +125 -0
  73. data/po/en/active-ldap.po +740 -85
  74. data/po/ja/active-ldap.po +748 -547
  75. data/rails/README +54 -0
  76. data/rails/init.rb +33 -0
  77. data/rails/plugin/active_ldap/generators/README +2 -0
  78. data/rails/plugin/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb +1 -1
  79. data/rails/plugin/active_ldap/init.rb +3 -0
  80. data/rails_generators/model_active_ldap/USAGE +17 -0
  81. data/rails_generators/model_active_ldap/model_active_ldap_generator.rb +69 -0
  82. data/rails_generators/model_active_ldap/templates/model_active_ldap.rb +3 -0
  83. data/rails_generators/model_active_ldap/templates/unit_test.rb +8 -0
  84. data/rails_generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb +7 -0
  85. data/rails_generators/scaffold_active_ldap/templates/ldap.yml +18 -0
  86. data/rails_generators/scaffold_al/scaffold_al_generator.rb +20 -0
  87. data/test-unit/History.txt +50 -1
  88. data/test-unit/Manifest.txt +22 -12
  89. data/test-unit/README.txt +31 -12
  90. data/test-unit/Rakefile +14 -1
  91. data/test-unit/TODO +5 -0
  92. data/test-unit/bin/testrb +0 -0
  93. data/test-unit/lib/test/unit.rb +62 -0
  94. data/test-unit/lib/test/unit/assertions.rb +419 -75
  95. data/test-unit/lib/test/unit/autorunner.rb +70 -13
  96. data/test-unit/lib/test/unit/collector.rb +1 -1
  97. data/test-unit/lib/test/unit/collector/load.rb +1 -1
  98. data/test-unit/lib/test/unit/color-scheme.rb +86 -0
  99. data/test-unit/lib/test/unit/color.rb +40 -5
  100. data/test-unit/lib/test/unit/diff.rb +14 -0
  101. data/test-unit/lib/test/unit/fixture.rb +7 -16
  102. data/test-unit/lib/test/unit/notification.rb +9 -0
  103. data/test-unit/lib/test/unit/omission.rb +14 -0
  104. data/test-unit/lib/test/unit/pending.rb +16 -0
  105. data/test-unit/lib/test/unit/priority.rb +17 -2
  106. data/test-unit/lib/test/unit/runner/console.rb +8 -2
  107. data/test-unit/lib/test/unit/testcase.rb +188 -2
  108. data/test-unit/lib/test/unit/ui/console/testrunner.rb +51 -26
  109. data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
  110. data/test-unit/lib/test/unit/version.rb +1 -1
  111. data/test-unit/sample/test_user.rb +22 -0
  112. data/test-unit/test/collector/{test_descendant.rb → test-descendant.rb} +0 -0
  113. data/test-unit/test/collector/{test_load.rb → test-load.rb} +1 -1
  114. data/test-unit/test/run-test.rb +0 -0
  115. data/test-unit/test/{test_attribute.rb → test-attribute.rb} +0 -0
  116. data/test-unit/test/test-color-scheme.rb +56 -0
  117. data/test-unit/test/{test_color.rb → test-color.rb} +10 -0
  118. data/test-unit/test/{test_diff.rb → test-diff.rb} +0 -0
  119. data/test-unit/test/{test_emacs_runner.rb → test-emacs-runner.rb} +0 -0
  120. data/test-unit/test/test-fixture.rb +287 -0
  121. data/test-unit/test/{test_notification.rb → test-notification.rb} +4 -4
  122. data/test-unit/test/{test_omission.rb → test-omission.rb} +6 -6
  123. data/test-unit/test/{test_pending.rb → test-pending.rb} +12 -6
  124. data/test-unit/test/{test_priority.rb → test-priority.rb} +30 -0
  125. data/test-unit/test/test_assertions.rb +411 -69
  126. data/test-unit/test/test_testcase.rb +70 -3
  127. data/test-unit/test/{testunit_test_util.rb → testunit-test-util.rb} +4 -2
  128. data/test-unit/test/ui/test_testrunmediator.rb +1 -1
  129. data/test-unit/test/util/test-method-owner-finder.rb +38 -0
  130. data/test/run-test.rb +0 -0
  131. data/test/test_adapter.rb +3 -0
  132. data/test/test_associations.rb +50 -7
  133. data/test/test_base.rb +193 -11
  134. data/test/test_connection_per_dn.rb +1 -1
  135. data/test/test_ldif.rb +86 -0
  136. data/test/test_load.rb +7 -0
  137. data/test/test_schema.rb +31 -1
  138. data/test/test_syntax.rb +20 -0
  139. data/test/test_user_password.rb +22 -14
  140. data/test/test_validation.rb +70 -29
  141. metadata +99 -77
  142. data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
  143. data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
  144. data/examples/al-admin/config/initializers/ralative_url_support.rb +0 -1
  145. data/examples/al-admin/lib/accept_http_rails_relative_url_root.rb +0 -9
  146. data/test-unit-ext/misc/rd2html.rb +0 -42
  147. data/test-unit/test/test_fixture.rb +0 -275
@@ -87,7 +87,7 @@ class TestConnectionPerDN < Test::Unit::TestCase
87
87
  assert_not_equal(group1.connection, user.connection)
88
88
  assert_equal(user.groups[0].connection, user.connection)
89
89
 
90
- assert_raise(ActiveLdap::LdapError::InsufficientAccess) do
90
+ assert_raise(ActiveLdap::OperationNotPermitted) do
91
91
  user.groups << group2
92
92
  end
93
93
  assert_equal([group1.cn], user.groups.collect(&:cn))
@@ -9,8 +9,94 @@ class TestLDIF < Test::Unit::TestCase
9
9
  include AlTestUtils::ExampleFile
10
10
 
11
11
  priority :must
12
+ def test_accept_empty_lines_after_content
13
+ ldif_source = <<-EOL
14
+ version: 1
15
+ dn: dc=devel,dc=example,dc=com
16
+ dc: devel
17
+ objectClass: top
18
+ objectClass: dcObject
19
+ objectClass: organization
20
+ o: devel
21
+ EOL
22
+
23
+ expected_ldif_to_s = <<-EOL
24
+ version: 1
25
+ dn: dc=devel,dc=example,dc=com
26
+ dc: devel
27
+ o: devel
28
+ objectClass: dcObject
29
+ objectClass: organization
30
+ objectClass: top
31
+ EOL
32
+
33
+
34
+ assert_ldif_to_s(expected_ldif_to_s, ldif_source)
35
+ assert_ldif_to_s(expected_ldif_to_s, ldif_source + "\n")
36
+ assert_ldif_to_s(expected_ldif_to_s, ldif_source + "\n\n")
37
+ assert_ldif_to_s(expected_ldif_to_s, ldif_source + ("\n" * 10))
38
+ end
39
+
40
+ def test_accept_comments_after_content
41
+ ldif_source = <<-EOL
42
+ version: 1
43
+ dn: dc=devel,dc=example,dc=com
44
+ dc: devel
45
+ objectClass: top
46
+ objectClass: dcObject
47
+ objectClass: organization
48
+ o: devel
49
+
50
+ # search result
51
+
52
+ # numResponse: 1
53
+ # numEntries: 1
54
+
55
+ EOL
56
+
57
+ assert_ldif_to_s(<<-EOL, ldif_source)
58
+ version: 1
59
+ dn: dc=devel,dc=example,dc=com
60
+ dc: devel
61
+ o: devel
62
+ objectClass: dcObject
63
+ objectClass: organization
64
+ objectClass: top
65
+ EOL
66
+ end
12
67
 
13
68
  priority :normal
69
+ def test_comments_and_empty_lines_before_content
70
+ ldif_source = <<-EOL
71
+ version: 1
72
+
73
+ #
74
+ # LDAPv3
75
+ # base <dc=devel,dc=clear-code,dc=com> with scope subtree
76
+ # filter: (objectclass=*)
77
+ # requesting: ALL
78
+ #
79
+
80
+ # devel.example.com
81
+ dn: dc=devel,dc=example,dc=com
82
+ dc: devel
83
+ objectClass: top
84
+ objectClass: dcObject
85
+ objectClass: organization
86
+ o: devel
87
+ EOL
88
+
89
+ assert_ldif_to_s(<<-EOL, ldif_source)
90
+ version: 1
91
+ dn: dc=devel,dc=example,dc=com
92
+ dc: devel
93
+ o: devel
94
+ objectClass: dcObject
95
+ objectClass: organization
96
+ objectClass: top
97
+ EOL
98
+ end
99
+
14
100
  def test_unknown_change_type
15
101
  ldif_source = <<-EOL
16
102
  version: 1
@@ -16,6 +16,12 @@ class TestLoad < Test::Unit::TestCase
16
16
  record = ActiveLdap::LDIF::ModifyRecord.new(user.dn)
17
17
  ldif << record
18
18
 
19
+ original_home_directory = user.home_directory
20
+ new_home_directory = "#{original_home_directory}-new"
21
+ record.add_operation(:delete, "homeDirectory", [], {})
22
+ record.add_operation(:add, "homeDirectory", [],
23
+ {"homeDirectory" => [new_home_directory]})
24
+
19
25
  original_descriptions = user.description(true)
20
26
  new_description = "new description"
21
27
  record.add_operation(:add, "description", [],
@@ -30,6 +36,7 @@ class TestLoad < Test::Unit::TestCase
30
36
  ActiveLdap::Base.load(ldif.to_s)
31
37
 
32
38
  user = @user_class.find(user.dn)
39
+ assert_equal(new_home_directory, user.home_directory)
33
40
  assert_equal(original_descriptions + [new_description],
34
41
  user.description(true))
35
42
  assert_nil(user.display_name)
@@ -2,6 +2,37 @@ require 'al-test-utils'
2
2
 
3
3
  class TestSchema < Test::Unit::TestCase
4
4
  priority :must
5
+ def test_oid_list_with_just_only_one_oid
6
+ ou_schema = "( 2.5.6.5 NAME 'organizationalUnit' SUP top STRUCTURAL MUST " +
7
+ "(ou ) MAY (c $ l $ st $ street $ searchGuide $ businessCategory $ " +
8
+ "postalAddress $ postalCode $ postOfficeBox $ " +
9
+ "physicalDeliveryOfficeName $ telephoneNumber $ telexNumber $ " +
10
+ "teletexTerminalIdentifier $ facsimileTelephoneNumber $ x121Address $ " +
11
+ "internationalISDNNumber $ registeredAddress $ destinationIndicator $ " +
12
+ "preferredDeliveryMethod $ seeAlso $ userPassword $ co $ countryCode $ " +
13
+ "desktopProfile $ defaultGroup $ managedBy $ uPNSuffixes $ gPLink $ " +
14
+ "gPOptions $ msCOM-UserPartitionSetLink $ thumbnailLogo ) ) "
15
+
16
+ expect = {
17
+ :name => ["organizationalUnit"],
18
+ :sup => ["top"],
19
+ :structural => ["TRUE"],
20
+ :must => %w(ou),
21
+ :may => %w(c l st street searchGuide businessCategory
22
+ postalAddress postalCode postOfficeBox
23
+ physicalDeliveryOfficeName telephoneNumber telexNumber
24
+ teletexTerminalIdentifier facsimileTelephoneNumber
25
+ x121Address internationalISDNNumber registeredAddress
26
+ destinationIndicator preferredDeliveryMethod seeAlso
27
+ userPassword co countryCode desktopProfile defaultGroup
28
+ managedBy uPNSuffixes gPLink gPOptions
29
+ msCOM-UserPartitionSetLink thumbnailLogo),
30
+ }
31
+ assert_schema(expect, "2.5.6.5", ou_schema)
32
+ assert_schema(expect, "organizationalUnit", ou_schema)
33
+ end
34
+
35
+ priority :normal
5
36
  def test_normalize_attribute_value
6
37
  entry = {
7
38
  "attributeTypes" =>
@@ -31,7 +62,6 @@ class TestSchema < Test::Unit::TestCase
31
62
  {"lang-ja" => "co.jp"}]))
32
63
  end
33
64
 
34
- priority :normal
35
65
  def test_syntax_validation
36
66
  entry = {
37
67
  "attributeTypes" =>
@@ -93,6 +93,26 @@ class TestSyntax < Test::Unit::TestCase
93
93
  assert_type_cast(Time.parse("1994/12/16 10:32:12.345 +09:00"),
94
94
  "19941216103212.345+0900",
95
95
  "Generalized Time")
96
+ begin
97
+ Time.utc(1601)
98
+ assert_type_cast(Time.utc(1601, 1, 1, 0, 4, 17),
99
+ "16010101000417.0Z",
100
+ "Generalized Time")
101
+ rescue ArgumentError
102
+ assert_type_cast(Time.at(0),
103
+ "16010101000417.0Z",
104
+ "Generalized Time")
105
+ end
106
+
107
+ begin
108
+ Time.at(-1)
109
+ rescue ArgumentError
110
+ if $!.message == "argument out of range"
111
+ assert_type_cast(Time.parse("1969/12/31 23:59:59 +00:00"),
112
+ "19691231235959+0000",
113
+ "Generalized Time")
114
+ end
115
+ end
96
116
  end
97
117
 
98
118
  def test_integer_type_cast
@@ -45,18 +45,18 @@ class TestUserPassword < Test::Unit::TestCase
45
45
 
46
46
  password = "PASSWORD"
47
47
  hashed_password = ActiveLdap::UserPassword.smd5(password)
48
- salt = Base64.decode64(hashed_password.sub(/^\{SMD5\}/, ''))[-4, 4]
48
+ salt = decode64(hashed_password.sub(/^\{SMD5\}/, ''))[-4, 4]
49
49
  assert_equal(hashed_password,
50
50
  ActiveLdap::UserPassword.smd5(password, salt))
51
51
  end
52
52
 
53
53
  def test_extract_salt_for_smd5
54
- assert_extract_salt(:smd5, nil, Base64.encode64("").chomp)
55
- assert_extract_salt(:smd5, nil, Base64.encode64("1").chomp)
56
- assert_extract_salt(:smd5, nil, Base64.encode64("12").chomp)
57
- assert_extract_salt(:smd5, nil, Base64.encode64("123").chomp)
58
- assert_extract_salt(:smd5, "ABCD", Base64.encode64("ABCD").chomp)
59
- assert_extract_salt(:smd5, "BCDE", Base64.encode64("ABCDE").chomp)
54
+ assert_extract_salt(:smd5, nil, encode64(""))
55
+ assert_extract_salt(:smd5, nil, encode64("1"))
56
+ assert_extract_salt(:smd5, nil, encode64("12"))
57
+ assert_extract_salt(:smd5, nil, encode64("123"))
58
+ assert_extract_salt(:smd5, "ABCD", encode64("ABCD"))
59
+ assert_extract_salt(:smd5, "BCDE", encode64("ABCDE"))
60
60
  end
61
61
 
62
62
  def test_sha
@@ -70,18 +70,18 @@ class TestUserPassword < Test::Unit::TestCase
70
70
 
71
71
  password = "PASSWORD"
72
72
  hashed_password = ActiveLdap::UserPassword.ssha(password)
73
- salt = Base64.decode64(hashed_password.sub(/^\{SSHA\}/, ''))[-4, 4]
73
+ salt = decode64(hashed_password.sub(/^\{SSHA\}/, ''))[-4, 4]
74
74
  assert_equal(hashed_password,
75
75
  ActiveLdap::UserPassword.ssha(password, salt))
76
76
  end
77
77
 
78
78
  def test_extract_salt_for_ssha
79
- assert_extract_salt(:ssha, nil, Base64.encode64("").chomp)
80
- assert_extract_salt(:ssha, nil, Base64.encode64("1").chomp)
81
- assert_extract_salt(:ssha, nil, Base64.encode64("12").chomp)
82
- assert_extract_salt(:ssha, nil, Base64.encode64("123").chomp)
83
- assert_extract_salt(:ssha, "ABCD", Base64.encode64("ABCD").chomp)
84
- assert_extract_salt(:ssha, "BCDE", Base64.encode64("ABCDE").chomp)
79
+ assert_extract_salt(:ssha, nil, encode64(""))
80
+ assert_extract_salt(:ssha, nil, encode64("1"))
81
+ assert_extract_salt(:ssha, nil, encode64("12"))
82
+ assert_extract_salt(:ssha, nil, encode64("123"))
83
+ assert_extract_salt(:ssha, "ABCD", encode64("ABCD"))
84
+ assert_extract_salt(:ssha, "BCDE", encode64("ABCDE"))
85
85
  end
86
86
 
87
87
  private
@@ -90,4 +90,12 @@ class TestUserPassword < Test::Unit::TestCase
90
90
  hashed_password)
91
91
  assert_equal(expected, actual)
92
92
  end
93
+
94
+ def encode64(string)
95
+ [string].pack('m').chomp
96
+ end
97
+
98
+ def decode64(string)
99
+ string.unpack('m')[0]
100
+ end
93
101
  end
@@ -6,6 +6,59 @@ class TestValidation < Test::Unit::TestCase
6
6
  include ActiveLdap::Helper
7
7
 
8
8
  priority :must
9
+ def test_set_attributes_with_invalid_dn_attribute_value
10
+ user = nil
11
+ assert_nothing_raised do
12
+ user = @user_class.new(:uid => "=", :cn => "#")
13
+ end
14
+ assert(!user.valid?)
15
+ end
16
+
17
+ priority :normal
18
+ def test_set_attribute_to_invalid_dn_attribute_value_object
19
+ user = @user_class.new("=")
20
+ assert_nothing_raised do
21
+ user.uid_number = 11111
22
+ end
23
+ assert_equal(11111, user.uid_number)
24
+ end
25
+
26
+ def test_dn_validate_on_new
27
+ user = @user_class.new("=")
28
+ assert(!user.valid?)
29
+ reason = _("attribute value is missing")
30
+ invalid_format = _("%s is invalid distinguished name (DN): %s")
31
+ invalid_message = invalid_format % ["uid==,#{user.class.base}", reason]
32
+ message = _("is invalid: %s") % invalid_message
33
+ message = "Dn" + " " + message
34
+ assert_equal([message],
35
+ user.errors.full_messages.find_all {|m| /DN/ =~ m})
36
+ end
37
+
38
+ def test_dn_validate
39
+ make_temporary_user do |user,|
40
+ user.uid = "="
41
+ assert(!user.valid?)
42
+ reason = _("attribute value is missing")
43
+ invalid_format = _("%s is invalid distinguished name (DN): %s")
44
+ invalid_message = invalid_format % ["uid==,#{user.class.base}", reason]
45
+ message = _("is invalid: %s") % invalid_message
46
+ message = "Dn" + " " + message
47
+ assert_equal([message], user.errors.full_messages)
48
+ end
49
+ end
50
+
51
+ def test_not_validate_empty_string
52
+ make_temporary_user do |user,|
53
+ assert(user.valid?)
54
+ user.uid_number = ""
55
+ assert(!user.valid?)
56
+ format = _("is required attribute by objectClass '%s'")
57
+ blank_message = la_("uidNumber") + ' ' + (format % loc_("posixAccount"))
58
+ assert_equal([blank_message], user.errors.full_messages)
59
+ end
60
+ end
61
+
9
62
  def test_validate_excluded_classes
10
63
  make_temporary_user do |user,|
11
64
  user.save
@@ -13,19 +66,14 @@ class TestValidation < Test::Unit::TestCase
13
66
  assert(user.save)
14
67
  user.class.excluded_classes = ['person']
15
68
  assert(!user.save)
16
- if ActiveLdap.get_text_supported?
17
- format = n_("%{fn} has excluded value: %s",
18
- "%{fn} has excluded values: %s",
19
- 1) % {:fn => la_("objectClass")}
20
- message = format % loc_("person")
21
- else
22
- message = "objectClass has excluded value: person"
23
- end
69
+ format = n_("has excluded value: %s",
70
+ "has excluded values: %s",
71
+ 1)
72
+ message = la_("objectClass") + ' ' + (format % loc_("person"))
24
73
  assert_equal([message], user.errors.full_messages)
25
74
  end
26
75
  end
27
76
 
28
- priority :normal
29
77
  def test_valid_subtype_and_single_value
30
78
  make_temporary_user do |user, password|
31
79
  user.display_name = [{"lang-ja" => ["ユーザ"]},
@@ -89,12 +137,8 @@ class TestValidation < Test::Unit::TestCase
89
137
  assert(ou_class.new("YYY").save)
90
138
  ou = ou_class.new("YYY")
91
139
  assert(!ou.save)
92
- if ActiveLdap.get_text_supported?
93
- format = _("%{fn} is duplicated: %s") % {:fn => la_("DN")}
94
- else
95
- format = "Dn " + _("is duplicated: %s")
96
- end
97
- assert_equal([format % ou.dn], ou.errors.full_messages)
140
+ message = la_("DN") + ' ' + (_("is duplicated: %s") % ou.dn)
141
+ assert_equal([message], ou.errors.full_messages)
98
142
  end
99
143
 
100
144
  def test_save!
@@ -106,6 +150,9 @@ class TestValidation < Test::Unit::TestCase
106
150
  end
107
151
 
108
152
  @group_class.validates_presence_of(:description)
153
+ def @group_class.name
154
+ "Group"
155
+ end
109
156
  assert_raises(ActiveLdap::EntryInvalid) do
110
157
  group.save!
111
158
  end
@@ -121,6 +168,9 @@ class TestValidation < Test::Unit::TestCase
121
168
  assert_equal([], group.errors.to_a)
122
169
 
123
170
  @group_class.validates_presence_of(:description)
171
+ def @group_class.name
172
+ "Group"
173
+ end
124
174
  assert(!group.valid?)
125
175
  assert(group.errors.invalid?(:description))
126
176
  assert_equal(1, group.errors.size)
@@ -133,22 +183,13 @@ class TestValidation < Test::Unit::TestCase
133
183
  assert_not_nil(syntax_description)
134
184
  params = [formatted_value, syntax_description, reason]
135
185
  params.unshift(option) if option
136
- if ActiveLdap.get_text_supported?
137
- if option
138
- format = _("%{fn} (%s) has invalid format: %s: required syntax: %s: %s")
139
- else
140
- format = _("%{fn} has invalid format: %s: required syntax: %s: %s")
141
- end
142
- format = format % {:fn => la_(name)}
143
- assert_equal([format % params], model.errors.full_messages)
186
+ if option
187
+ format = _("(%s) has invalid format: %s: required syntax: %s: %s")
144
188
  else
145
- if option
146
- format = _("(%s) has invalid format: %s: required syntax: %s: %s")
147
- else
148
- format = _("has invalid format: %s: required syntax: %s: %s")
149
- end
150
- assert_equal(["#{name} #{format % params}"], model.errors.full_messages)
189
+ format = _("has invalid format: %s: required syntax: %s: %s")
151
190
  end
191
+ message = la_(name) + ' ' + (format % params)
192
+ assert_equal([message], model.errors.full_messages)
152
193
  end
153
194
 
154
195
  def assert_invalid_see_also_value(invalid_value, value, option=nil)
metadata CHANGED
@@ -1,36 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: activeldap
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2008-06-15 00:00:00 -07:00
8
- summary: Ruby/ActiveLdap is a object-oriented API to LDAP
9
- require_paths:
10
- - lib
11
- email:
12
- - redpig@dataspill.org
13
- - kou@cozmixng.org
14
- homepage: http://rubyforge.org/projects/ruby-activeldap/
15
- rubyforge_project: ruby-activeldap
16
- description: "'Ruby/ActiveLdap' is a ruby extension library which provides a clean objected oriented interface to the Ruby/LDAP library. It was inspired by ActiveRecord. This is not nearly as clean or as flexible as ActiveRecord, but it is still trivial to define new objects and manipulate them with minimal difficulty."
17
- autorequire: active_ldap
18
- default_executable:
19
- bindir: bin
20
- has_rdoc: true
21
- required_ruby_version: !ruby/object:Gem::Version::Requirement
22
- requirements:
23
- - - ">"
24
- - !ruby/object:Gem::Version
25
- version: 0.0.0
26
- version:
4
+ version: 1.0.2
27
5
  platform: ruby
28
- signing_key:
29
- cert_chain:
30
- post_install_message:
31
6
  authors:
32
7
  - Will Drewry
33
8
  - Kouhei Sutou
9
+ autorequire: active_ldap
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-02-22 00:00:00 -06:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activerecord
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: hoe
28
+ type: :development
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.8.3
35
+ version:
36
+ description: "'Ruby/ActiveLdap' is a ruby extension library which provides a clean objected oriented interface to the Ruby/LDAP library. It was inspired by ActiveRecord. This is not nearly as clean or as flexible as ActiveRecord, but it is still trivial to define new objects and manipulate them with minimal difficulty."
37
+ email:
38
+ - redpig@dataspill.org
39
+ - kou@cozmixng.org
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files:
45
+ - examples/al-admin/public/robots.txt
46
+ - test-unit/History.txt
47
+ - test-unit/Manifest.txt
48
+ - test-unit/README.txt
34
49
  files:
35
50
  - CHANGES
36
51
  - COPYING
@@ -40,8 +55,6 @@ files:
40
55
  - TODO
41
56
  - benchmark/bench-al.rb
42
57
  - benchmark/config.yaml.sample
43
- - data/locale/en/LC_MESSAGES/active-ldap.mo
44
- - data/locale/ja/LC_MESSAGES/active-ldap.mo
45
58
  - examples/al-admin/README
46
59
  - examples/al-admin/Rakefile
47
60
  - examples/al-admin/app/controllers/account_controller.rb
@@ -109,11 +122,9 @@ files:
109
122
  - examples/al-admin/config/initializers/gettext.rb
110
123
  - examples/al-admin/config/initializers/inflections.rb
111
124
  - examples/al-admin/config/initializers/mime_types.rb
112
- - examples/al-admin/config/initializers/ralative_url_support.rb
113
125
  - examples/al-admin/config/ldap.yml.example
114
126
  - examples/al-admin/config/routes.rb
115
127
  - examples/al-admin/db/migrate/001_create_users.rb
116
- - examples/al-admin/lib/accept_http_rails_relative_url_root.rb
117
128
  - examples/al-admin/lib/authenticated_system.rb
118
129
  - examples/al-admin/lib/authenticated_test_helper.rb
119
130
  - examples/al-admin/lib/tasks/gettext.rake
@@ -315,6 +326,7 @@ files:
315
326
  - examples/al-admin/public/stylesheets/welcome.css
316
327
  - examples/al-admin/script/about
317
328
  - examples/al-admin/script/console
329
+ - examples/al-admin/script/dbconsole
318
330
  - examples/al-admin/script/destroy
319
331
  - examples/al-admin/script/generate
320
332
  - examples/al-admin/script/performance/benchmarker
@@ -417,9 +429,13 @@ files:
417
429
  - lib/active_ldap/timeout_stub.rb
418
430
  - lib/active_ldap/user_password.rb
419
431
  - lib/active_ldap/validations.rb
432
+ - lib/active_ldap/xml.rb
420
433
  - po/en/active-ldap.po
421
434
  - po/ja/active-ldap.po
435
+ - rails/README
436
+ - rails/init.rb
422
437
  - rails/plugin/active_ldap/README
438
+ - rails/plugin/active_ldap/generators/README
423
439
  - rails/plugin/active_ldap/generators/model_active_ldap/USAGE
424
440
  - rails/plugin/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb
425
441
  - rails/plugin/active_ldap/generators/model_active_ldap/templates/fixtures.yml
@@ -428,11 +444,18 @@ files:
428
444
  - rails/plugin/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb
429
445
  - rails/plugin/active_ldap/generators/scaffold_al/scaffold_al_generator.rb
430
446
  - rails/plugin/active_ldap/init.rb
431
- - test-unit-ext/misc/rd2html.rb
447
+ - rails_generators/model_active_ldap/USAGE
448
+ - rails_generators/model_active_ldap/model_active_ldap_generator.rb
449
+ - rails_generators/model_active_ldap/templates/model_active_ldap.rb
450
+ - rails_generators/model_active_ldap/templates/unit_test.rb
451
+ - rails_generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb
452
+ - rails_generators/scaffold_active_ldap/templates/ldap.yml
453
+ - rails_generators/scaffold_al/scaffold_al_generator.rb
432
454
  - test-unit/History.txt
433
455
  - test-unit/Manifest.txt
434
456
  - test-unit/README.txt
435
457
  - test-unit/Rakefile
458
+ - test-unit/TODO
436
459
  - test-unit/bin/testrb
437
460
  - test-unit/lib/test/unit.rb
438
461
  - test-unit/lib/test/unit/assertionfailederror.rb
@@ -444,6 +467,7 @@ files:
444
467
  - test-unit/lib/test/unit/collector/dir.rb
445
468
  - test-unit/lib/test/unit/collector/load.rb
446
469
  - test-unit/lib/test/unit/collector/objectspace.rb
470
+ - test-unit/lib/test/unit/color-scheme.rb
447
471
  - test-unit/lib/test/unit/color.rb
448
472
  - test-unit/lib/test/unit/diff.rb
449
473
  - test-unit/lib/test/unit/error.rb
@@ -466,6 +490,7 @@ files:
466
490
  - test-unit/lib/test/unit/ui/testrunnermediator.rb
467
491
  - test-unit/lib/test/unit/ui/testrunnerutilities.rb
468
492
  - test-unit/lib/test/unit/util/backtracefilter.rb
493
+ - test-unit/lib/test/unit/util/method-owner-finder.rb
469
494
  - test-unit/lib/test/unit/util/observable.rb
470
495
  - test-unit/lib/test/unit/util/procwrapper.rb
471
496
  - test-unit/lib/test/unit/version.rb
@@ -473,29 +498,32 @@ files:
473
498
  - test-unit/sample/subtracter.rb
474
499
  - test-unit/sample/tc_adder.rb
475
500
  - test-unit/sample/tc_subtracter.rb
501
+ - test-unit/sample/test_user.rb
476
502
  - test-unit/sample/ts_examples.rb
477
- - test-unit/test/collector/test_descendant.rb
503
+ - test-unit/test/collector/test-descendant.rb
504
+ - test-unit/test/collector/test-load.rb
478
505
  - test-unit/test/collector/test_dir.rb
479
- - test-unit/test/collector/test_load.rb
480
506
  - test-unit/test/collector/test_objectspace.rb
481
507
  - test-unit/test/run-test.rb
508
+ - test-unit/test/test-attribute.rb
509
+ - test-unit/test/test-color-scheme.rb
510
+ - test-unit/test/test-color.rb
511
+ - test-unit/test/test-diff.rb
512
+ - test-unit/test/test-emacs-runner.rb
513
+ - test-unit/test/test-fixture.rb
514
+ - test-unit/test/test-notification.rb
515
+ - test-unit/test/test-omission.rb
516
+ - test-unit/test/test-pending.rb
517
+ - test-unit/test/test-priority.rb
482
518
  - test-unit/test/test_assertions.rb
483
- - test-unit/test/test_attribute.rb
484
- - test-unit/test/test_color.rb
485
- - test-unit/test/test_diff.rb
486
- - test-unit/test/test_emacs_runner.rb
487
519
  - test-unit/test/test_error.rb
488
520
  - test-unit/test/test_failure.rb
489
- - test-unit/test/test_fixture.rb
490
- - test-unit/test/test_notification.rb
491
- - test-unit/test/test_omission.rb
492
- - test-unit/test/test_pending.rb
493
- - test-unit/test/test_priority.rb
494
521
  - test-unit/test/test_testcase.rb
495
522
  - test-unit/test/test_testresult.rb
496
523
  - test-unit/test/test_testsuite.rb
497
- - test-unit/test/testunit_test_util.rb
524
+ - test-unit/test/testunit-test-util.rb
498
525
  - test-unit/test/ui/test_testrunmediator.rb
526
+ - test-unit/test/util/test-method-owner-finder.rb
499
527
  - test-unit/test/util/test_backtracefilter.rb
500
528
  - test-unit/test/util/test_observable.rb
501
529
  - test-unit/test/util/test_procwrapper.rb
@@ -540,6 +568,34 @@ files:
540
568
  - test/test_usermod-lang-add.rb
541
569
  - test/test_usermod.rb
542
570
  - test/test_validation.rb
571
+ has_rdoc: true
572
+ homepage: http://rubyforge.org/projects/ruby-activeldap/
573
+ post_install_message:
574
+ rdoc_options:
575
+ - --main
576
+ - lib/active_ldap.rb
577
+ require_paths:
578
+ - lib
579
+ required_ruby_version: !ruby/object:Gem::Requirement
580
+ requirements:
581
+ - - ">="
582
+ - !ruby/object:Gem::Version
583
+ version: "0"
584
+ version:
585
+ required_rubygems_version: !ruby/object:Gem::Requirement
586
+ requirements:
587
+ - - ">="
588
+ - !ruby/object:Gem::Version
589
+ version: "0"
590
+ version:
591
+ requirements:
592
+ - ruby-ldap >= 0.8.2
593
+ - (Open)LDAP server
594
+ rubyforge_project: ruby-activeldap
595
+ rubygems_version: 1.3.1
596
+ signing_key:
597
+ specification_version: 2
598
+ summary: Ruby/ActiveLdap is a object-oriented API to LDAP
543
599
  test_files:
544
600
  - test/test_acts_as_tree.rb
545
601
  - test/test_adapter.rb
@@ -578,37 +634,3 @@ test_files:
578
634
  - test/test_usermod-lang-add.rb
579
635
  - test/test_usermod.rb
580
636
  - test/test_validation.rb
581
- rdoc_options:
582
- - --main
583
- - lib/active_ldap.rb
584
- extra_rdoc_files:
585
- - examples/al-admin/public/robots.txt
586
- - test-unit/History.txt
587
- - test-unit/Manifest.txt
588
- - test-unit/README.txt
589
- executables: []
590
-
591
- extensions: []
592
-
593
- requirements:
594
- - ruby-ldap >= 0.8.2
595
- - (Open)LDAP server
596
- dependencies:
597
- - !ruby/object:Gem::Dependency
598
- name: activerecord
599
- version_requirement:
600
- version_requirements: !ruby/object:Gem::Version::Requirement
601
- requirements:
602
- - - ">"
603
- - !ruby/object:Gem::Version
604
- version: 0.0.0
605
- version:
606
- - !ruby/object:Gem::Dependency
607
- name: hoe
608
- version_requirement:
609
- version_requirements: !ruby/object:Gem::Version::Requirement
610
- requirements:
611
- - - ">="
612
- - !ruby/object:Gem::Version
613
- version: 1.5.0
614
- version: