diff options
Diffstat (limited to 'lib/ldb/tests')
-rw-r--r-- | lib/ldb/tests/test-dup-2.ldif | 6 | ||||
-rw-r--r-- | lib/ldb/tests/test-dup.ldif | 13 | ||||
-rwxr-xr-x | lib/ldb/tests/test-generic.sh | 21 | ||||
-rw-r--r-- | lib/ldb/tests/test-modify-unmet-2.ldif | 7 | ||||
-rw-r--r-- | lib/ldb/tests/test-modify-unmet.ldif | 15 |
5 files changed, 62 insertions, 0 deletions
diff --git a/lib/ldb/tests/test-dup-2.ldif b/lib/ldb/tests/test-dup-2.ldif new file mode 100644 index 0000000000..a4261012ad --- /dev/null +++ b/lib/ldb/tests/test-dup-2.ldif @@ -0,0 +1,6 @@ +dn: cn=Sentinel,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST +objectclass: OpenLDAPperson +cn: Sentinel +sn: USER +uid: USER, Sentinel + diff --git a/lib/ldb/tests/test-dup.ldif b/lib/ldb/tests/test-dup.ldif new file mode 100644 index 0000000000..b35420befb --- /dev/null +++ b/lib/ldb/tests/test-dup.ldif @@ -0,0 +1,13 @@ +dn: cn=Fred Bassett,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST +objectclass: OpenLDAPperson +cn: Fred Bassett +sn: Bassett +uid: Bassett, Fred + +dn: cn=Sentinel,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST +objectclass: OpenLDAPperson +cn: Sentinel +sn: USER +uid: USER, Sentinel + + diff --git a/lib/ldb/tests/test-generic.sh b/lib/ldb/tests/test-generic.sh index 9c45ed9614..69f901bd7c 100755 --- a/lib/ldb/tests/test-generic.sh +++ b/lib/ldb/tests/test-generic.sh @@ -16,9 +16,30 @@ $VALGRIND ldbadd $LDBDIR/tests/test.ldif 2> /dev/null && { exit 1 } +echo "Adding LDIF with one already-existing user again - should fail" +$VALGRIND ldbadd $LDBDIR/tests/test-dup.ldif 2> /dev/null && { + echo "Should have failed to add again - gave $?" + exit 1 +} + +echo "Adding again - should succeed (as previous failed)" +$VALGRIND ldbadd $LDBDIR/tests/test-dup-2.ldif || exit 1 + echo "Modifying elements" $VALGRIND ldbmodify $LDBDIR/tests/test-modify.ldif || exit 1 +echo "Modify LDIF with one un-met constraint - should fail" +$VALGRIND ldbadd $LDBDIR/tests/test-modify-unmet.ldif 2> /dev/null && { + echo "Should have failed to modify - gave $?" + exit 1 +} + +echo "Modify LDIF with after failure of un-met constraint - should also fail" +$VALGRIND ldbadd $LDBDIR/tests/test-modify-unmet-2.ldif 2> /dev/null && { + echo "Should have failed to modify - gave $?" + exit 1 +} + echo "Showing modified record" $VALGRIND ldbsearch '(uid=uham)' || exit 1 diff --git a/lib/ldb/tests/test-modify-unmet-2.ldif b/lib/ldb/tests/test-modify-unmet-2.ldif new file mode 100644 index 0000000000..8760938282 --- /dev/null +++ b/lib/ldb/tests/test-modify-unmet-2.ldif @@ -0,0 +1,7 @@ +dn: cn=Sentinel,ou=Alumni Association,ou=People,o=University of Michiga + n,c=TEST +changetype: modify +delete: drink +drink: water + + diff --git a/lib/ldb/tests/test-modify-unmet.ldif b/lib/ldb/tests/test-modify-unmet.ldif new file mode 100644 index 0000000000..6a46cdf611 --- /dev/null +++ b/lib/ldb/tests/test-modify-unmet.ldif @@ -0,0 +1,15 @@ +dn: cn=Sentinel,ou=Alumni Association,ou=People,o=University of Michiga + n,c=TEST +changetype: modify +add: drink +drink: water + +dn: cn=Sentinel,ou=Alumni Association,ou=People,o=University of Michiga + n,c=TEST +changetype: modify +add: sn +sn: TEST +- +delete: sn +sn: USER2 + |