From 3a97122ff585ceb10b1e78fe2cebc92fb3675c27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Baumbach?= Date: Mon, 18 Mar 2019 13:31:04 +0100 Subject: [PATCH] samba-tool tests: add test for 'samba-tool group edit' command MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Baumbach Reviewed-by: Andrew Bartlett --- python/samba/tests/samba_tool/group_edit.sh | 208 ++++++++++++++++++++ source4/selftest/tests.py | 3 +- 2 files changed, 210 insertions(+), 1 deletion(-) create mode 100755 python/samba/tests/samba_tool/group_edit.sh diff --git a/python/samba/tests/samba_tool/group_edit.sh b/python/samba/tests/samba_tool/group_edit.sh new file mode 100755 index 00000000000..90f5252d926 --- /dev/null +++ b/python/samba/tests/samba_tool/group_edit.sh @@ -0,0 +1,208 @@ +#!/bin/sh +# +# Test for 'samba-tool group edit' + +if [ $# -lt 3 ]; then +cat <$tmpeditor < \${group_ldif}.tmp +echo "member: $user_dn" >> \${group_ldif}.tmp + +mv \${group_ldif}.tmp \$group_ldif +EOF + + $PYTHON ${STpath}/source4/scripting/bin/samba-tool \ + group edit testgroup1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +get_member() { + $PYTHON ${STpath}/source4/scripting/bin/samba-tool \ + group listmembers testgroup1 \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +# Test edit group - add base64 attributes +add_attribute_base64() { + # create editor.sh + cat >$tmpeditor < \${group_ldif}.tmp +echo "displayName:: $display_name_b64" >> \${group_ldif}.tmp + +mv \${group_ldif}.tmp \$group_ldif +EOF + + $PYTHON ${STpath}/source4/scripting/bin/samba-tool group edit \ + testgroup1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +get_attribute_base64() { + $PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \ + testgroup1 --attributes=displayName \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +delete_attribute() { + # create editor.sh + cat >$tmpeditor <> \${group_ldif}.tmp +mv \${group_ldif}.tmp \$group_ldif +EOF + $PYTHON ${STpath}/source4/scripting/bin/samba-tool group edit \ + testgroup1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +# Test edit group - add base64 attribute value including control character +add_attribute_base64_control() { + # create editor.sh + cat >$tmpeditor < \${group_ldif}.tmp +echo "displayName:: $display_name_con_b64" >> \${group_ldif}.tmp + +mv \${group_ldif}.tmp \$group_ldif +EOF + $PYTHON ${STpath}/source4/scripting/bin/samba-tool group edit \ + testgroup1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +get_attribute_base64_control() { + $PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \ + testgroup1 --attributes=displayName \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + + +# Test edit group - change base64 attribute value including control character +change_attribute_base64_control() { + # create editor.sh + cat >$tmpeditor <$tmpeditor <