test/test_ldif.rb in activeldap-1.0.0 vs test/test_ldif.rb in activeldap-1.0.1
- old
+ new
@@ -1,5 +1,7 @@
+# -*- coding: utf-8 -*-
+
require 'al-test-utils'
class TestLDIF < Test::Unit::TestCase
include ActiveLdap::GetTextSupport
include AlTestUtils::Assertions
@@ -560,10 +562,59 @@
-
delete: description
-
EOL
+ assert_ldif_to_s(<<-EOL, ldif_source)
+version: 1
+dn: cn=Fiona Jensen,ou=Marketing,dc=airius,dc=com
+changetype: add
+cn: Fiona Jensen
+objectclass: organizationalPerson
+objectclass: person
+objectclass: top
+sn: Jensen
+telephonenumber: +1 408 555 1212
+uid: fiona
+
+dn: cn=Robert Jensen,ou=Marketing,dc=airius,dc=com
+changetype: delete
+
+dn: cn=Paul Jensen,ou=Product Development,dc=airius,dc=com
+changetype: modrdn
+newrdn: cn=Paula Jensen
+deleteoldrdn: 1
+
+dn: ou=PD Accountants,ou=Product Development,dc=airius,dc=com
+changetype: modrdn
+newrdn: ou=Product Development Accountants
+deleteoldrdn: 0
+newsuperior: ou=Accounting,dc=airius,dc=com
+
+dn: cn=Paula Jensen,ou=Product Development,dc=airius,dc=com
+changetype: modify
+add: postaladdress
+postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
+-
+delete: description
+-
+replace: telephonenumber
+telephonenumber: +1 408 555 1234
+telephonenumber: +1 408 555 5678
+-
+delete: facsimiletelephonenumber
+facsimiletelephonenumber: +1 408 555 9876
+-
+
+dn: cn=Ingrid Jensen,ou=Product Support,dc=airius,dc=com
+changetype: modify
+replace: postaladdress
+-
+delete: description
+-
+EOL
+
change_attributes_add = {
"dn" => "cn=Fiona Jensen,ou=Marketing,dc=airius,dc=com",
"objectclass" => ["top", "person", "organizationalPerson"],
"cn" => ["Fiona Jensen"],
"sn" => ["Jensen"],
@@ -661,123 +712,9 @@
[operation.send("#{type}?"),
[operation.type, operation.attribute, operation.attributes]]
end
assert_equal(operations.collect {|operation| [true, operation]},
actual)
- end
-
- def test_multi_change_type_records
- ldif_source = <<-EOL
-version: 1
-# Add a new entry
-dn: cn=Fiona Jensen, ou=Marketing, dc=airius, dc=com
-changetype: add
-objectclass: top
-objectclass: person
-objectclass: organizationalPerson
-cn: Fiona Jensen
-sn: Jensen
-uid: fiona
-telephonenumber: +1 408 555 1212
-
-# Delete an existing entry
-dn: cn=Robert Jensen, ou=Marketing, dc=airius, dc=com
-changetype: delete
-
-# Modify an entry's relative distinguished name
-dn: cn=Paul Jensen, ou=Product Development, dc=airius, dc=com
-changetype: modrdn
-newrdn: cn=Paula Jensen
-deleteoldrdn: 1
-
-# Rename an entry and move all of its children to a new location in
-# the directory tree (only implemented by LDAPv3 servers).
-dn: ou=PD Accountants, ou=Product Development, dc=airius, dc=com
-changetype: modrdn
-newrdn: ou=Product Development Accountants
-deleteoldrdn: 0
-newsuperior: ou=Accounting, dc=airius, dc=com
-
-# Modify an entry: add an additional value to the postaladdress
-# attribute, completely delete the description attribute, replace
-# the telephonenumber attribute with two values, and delete a specific
-# value from the facsimiletelephonenumber attribute
-dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com
-changetype: modify
-add: postaladdress
-postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
--
-delete: description
--
-replace: telephonenumber
-telephonenumber: +1 408 555 1234
-telephonenumber: +1 408 555 5678
--
-delete: facsimiletelephonenumber
-facsimiletelephonenumber: +1 408 555 9876
--
-
-# Modify an entry: replace the postaladdress attribute with an empty
-# set of values (which will cause the attribute to be removed), and
-# delete the entire description attribute. Note that the first will
-# always succeed, while the second will only succeed if at least
-# one value for the description attribute is present.
-dn: cn=Ingrid Jensen, ou=Product Support, dc=airius, dc=com
-changetype: modify
-replace: postaladdress
--
-delete: description
--
-EOL
-
- assert_ldif_to_s(<<-EOL, ldif_source)
-version: 1
-dn: cn=Fiona Jensen,ou=Marketing,dc=airius,dc=com
-changetype: add
-cn: Fiona Jensen
-objectclass: organizationalPerson
-objectclass: person
-objectclass: top
-sn: Jensen
-telephonenumber: +1 408 555 1212
-uid: fiona
-
-dn: cn=Robert Jensen,ou=Marketing,dc=airius,dc=com
-changetype: delete
-
-dn: cn=Paul Jensen,ou=Product Development,dc=airius,dc=com
-changetype: modrdn
-newrdn: cn=Paula Jensen
-deleteoldrdn: 1
-
-dn: ou=PD Accountants,ou=Product Development,dc=airius,dc=com
-changetype: modrdn
-newrdn: ou=Product Development Accountants
-deleteoldrdn: 0
-newsuperior: ou=Accounting,dc=airius,dc=com
-
-dn: cn=Paula Jensen,ou=Product Development,dc=airius,dc=com
-changetype: modify
-add: postaladdress
-postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
--
-delete: description
--
-replace: telephonenumber
-telephonenumber: +1 408 555 1234
-telephonenumber: +1 408 555 5678
--
-delete: facsimiletelephonenumber
-facsimiletelephonenumber: +1 408 555 9876
--
-
-dn: cn=Ingrid Jensen,ou=Product Support,dc=airius,dc=com
-changetype: modify
-replace: postaladdress
--
-delete: description
--
-EOL
end
def test_modify_record
ldif_source = <<-EOL
version: 1