From: Björn Baumbach Date: Mon, 18 Mar 2019 11:00:24 +0000 (+0100) Subject: samba-tool tests: add test for 'samba-tool computer edit' command X-Git-Tag: ldb-2.0.5~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c26abd981d13071d8d85e1e3639bcb09857507a;p=thirdparty%2Fsamba.git samba-tool tests: add test for 'samba-tool computer edit' command Signed-off-by: Björn Baumbach Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/samba_tool/computer_edit.sh b/python/samba/tests/samba_tool/computer_edit.sh new file mode 100755 index 00000000000..fb6c668f2a3 --- /dev/null +++ b/python/samba/tests/samba_tool/computer_edit.sh @@ -0,0 +1,180 @@ +#!/bin/sh +# +# Test for 'samba-tool computer edit' + +if [ $# -lt 3 ]; then +cat <$tmpeditor <<-'EOF' +#!/usr/bin/env bash +computer_ldif="$1" +SED=$(which sed) +$SED -i -e 's/userAccountControl: 4098/userAccountControl: 4096/' $computer_ldif +EOF + + $PYTHON ${STpath}/source4/scripting/bin/samba-tool \ + computer edit testmachine1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +# Test edit computer - add base64 attributes +add_attribute_base64() { + # create editor.sh + cat >$tmpeditor < \${computer_ldif}.tmp +echo "displayName:: $display_name_b64" >> \${computer_ldif}.tmp + +mv \${computer_ldif}.tmp \$computer_ldif +EOF + + $PYTHON ${STpath}/source4/scripting/bin/samba-tool computer edit \ + testmachine1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +get_attribute_base64() { + $PYTHON ${STpath}/source4/scripting/bin/samba-tool computer show \ + testmachine1 --attributes=displayName \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +delete_attribute() { + # create editor.sh + cat >$tmpeditor <> \${computer_ldif}.tmp +mv \${computer_ldif}.tmp \$computer_ldif +EOF + $PYTHON ${STpath}/source4/scripting/bin/samba-tool computer edit \ + testmachine1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +# Test edit computer - add base64 attribute value including control character +add_attribute_base64_control() { + # create editor.sh + cat >$tmpeditor < \${computer_ldif}.tmp +echo "displayName:: $display_name_con_b64" >> \${computer_ldif}.tmp + +mv \${computer_ldif}.tmp \$computer_ldif +EOF + $PYTHON ${STpath}/source4/scripting/bin/samba-tool computer edit \ + testmachine1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +get_attribute_base64_control() { + $PYTHON ${STpath}/source4/scripting/bin/samba-tool computer show \ + testmachine1 --attributes=displayName \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + + +# Test edit computer - change base64 attribute value including control character +change_attribute_base64_control() { + # create editor.sh + cat >$tmpeditor <$tmpeditor <