| Server IP : 54.94.228.101 / Your IP : 172.28.1.13 Web Server : Apache System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/augeas/lenses/dist/tests/ |
Upload File : |
(* Test for LDIF lens *)
module Test_ldif =
(* Test LDIF content only *)
let content = "version: 1
dn: cn=foo bar,dc=example,dc=com
# test
ou: example value
cn:: Zm9vIGJhcg==
# test
telephoneNumber;foo;bar: +1 123 456 789
binary;foo:< file:///file/something
# test
dn: cn=simple,dc=example,dc=com
cn: simple
test: split line starts with
:colon
dn:: Y249c2ltcGxlLGRjPWV4YW1wbGUsZGM9Y29t
# test
cn: simple
dn: cn=simple,dc=exam
ple,dc=com
cn: simple
telephoneNumber:: KzEgMTIzIDQ1
NiA3ODk=
# test
"
test Ldif.lns get content =
{ "@content"
{ "version" = "1" }
{ "1" = "cn=foo bar,dc=example,dc=com"
{ "#comment" = "test" }
{ "ou" = "example value" }
{ "cn"
{ "@base64" = "Zm9vIGJhcg==" } }
{ "#comment" = "test" }
{ "telephoneNumber" = "+1 123 456 789"
{ "@option" = "foo" }
{ "@option" = "bar" } }
{ "binary"
{ "@option" = "foo" }
{ "@url" = "file:///file/something" } } }
{ "#comment" = "test" }
{}
{ "2" = "cn=simple,dc=example,dc=com"
{ "cn" = "simple" }
{ "test" = "split line starts with
:colon" } }
{}
{ "3"
{ "@base64" = "Y249c2ltcGxlLGRjPWV4YW1wbGUsZGM9Y29t" }
{ "#comment" = "test" }
{ "cn" = "simple" } }
{}
{ "4" = "cn=simple,dc=exam
ple,dc=com"
{ "cn" = "simple" }
{ "telephoneNumber"
{ "@base64" = "KzEgMTIzIDQ1
NiA3ODk=" } } }
{}
{ "#comment" = "test" }
}
(* Test LDIF changes *)
let changes = "version: 1
dn: cn=foo,dc=example,dc=com
changetype: delete
dn: cn=simple,dc=example,dc=com
control: 1.2.3.4
control: 1.2.3.4 true
# test
control: 1.2.3.4 true: foo bar
control: 1.2.3.4 true:: Zm9vIGJhcg==
changetype: add
cn: simple
dn: cn=foo bar,dc=example,dc=com
changeType: modify
add: telephoneNumber
telephoneNumber: +1 123 456 789
-
replace: homePostalAddress;lang-fr
homePostalAddress;lang-fr: 34 rue de Seine
# test
-
delete: telephoneNumber
-
replace: telephoneNumber
telephoneNumber:: KzEgMTIzIDQ1NiA3ODk=
-
dn: cn=foo,dc=example,dc=com
changetype: moddn
newrdn: cn=bar
deleteoldrdn: 0
newsuperior: dc=example,dc=net
"
test Ldif.lns get changes =
{ "@changes"
{ "version" = "1" }
{ "1" = "cn=foo,dc=example,dc=com"
{ "changetype" = "delete" } }
{}
{ "2" = "cn=simple,dc=example,dc=com"
{ "control" = "1.2.3.4" }
{ "control" = "1.2.3.4"
{ "criticality" = "true" } }
{ "#comment" = "test" }
{ "control" = "1.2.3.4"
{ "criticality" = "true" }
{ "value" = "foo bar" } }
{ "control" = "1.2.3.4"
{ "criticality" = "true" }
{ "value"
{ "@base64" = "Zm9vIGJhcg==" } } }
{ "changetype" = "add" }
{ "cn" = "simple" } }
{}
{ "3" = "cn=foo bar,dc=example,dc=com"
{ "changeType" = "modify" }
{ "add" = "telephoneNumber"
{ "telephoneNumber" = "+1 123 456 789" } }
{ "replace" = "homePostalAddress"
{ "@option" = "lang-fr" }
{ "homePostalAddress" = "34 rue de Seine"
{ "@option" = "lang-fr" } }
{ "#comment" = "test" } }
{ "delete" = "telephoneNumber" }
{ "replace" = "telephoneNumber"
{ "telephoneNumber"
{ "@base64" = "KzEgMTIzIDQ1NiA3ODk=" } } } }
{}
{ "4" = "cn=foo,dc=example,dc=com"
{ "changetype" = "moddn" }
{ "newrdn" = "cn=bar" }
{ "deleteoldrdn" = "0" }
{ "newsuperior" = "dc=example,dc=net" } }
}
(* Local Variables: *)
(* mode: caml *)
(* End: *)