plugins/python/regress: add tests for approval plugin

This commit is contained in:
Robert Manner
2020-02-11 14:39:59 +01:00
committed by Todd C. Miller
parent 80b3d86d6e
commit 43e256e34f
6 changed files with 234 additions and 0 deletions

View File

@@ -0,0 +1 @@
sudo: loading more than 8 sudo python approval plugins is not supported

View File

@@ -0,0 +1,67 @@
(APPROVAL 1) Constructed:
{
"plugin_options": [
"ModulePath=SRC_DIR/regress/plugin_approval_test.py",
"ClassName=ApprovalTestPlugin",
"Id=1"
],
"version": "1.15",
"settings": [
"SETTING1=VALUE1",
"setting2=value2"
],
"user_env": [
"USER_ENV1=VALUE1",
"USER_ENV2=value2"
],
"user_info": [
"INFO1=VALUE1",
"info2=value2"
],
"submit_optind": 3,
"submit_argv": [
"sudo",
"-u",
"user",
"whoami",
"--help"
],
"_id": "(APPROVAL 1)"
}
(APPROVAL 2) Constructed:
{
"plugin_options": [
"ModulePath=SRC_DIR/regress/plugin_approval_test.py",
"ClassName=ApprovalTestPlugin",
"Id=2"
],
"version": "1.15",
"settings": [
"SETTING1=VALUE1",
"setting2=value2"
],
"user_env": [
"USER_ENV1=VALUE1",
"USER_ENV2=value2"
],
"user_info": [
"INFO1=VALUE1",
"info2=value2"
],
"submit_optind": 3,
"submit_argv": [
"sudo",
"-u",
"user",
"whoami",
"--help"
],
"_id": "(APPROVAL 2)"
}
(APPROVAL 1) Show version was called with arguments: (0,)
Python approval plugin API version 1.0
(APPROVAL 2) Show version was called with arguments: (1,)
(APPROVAL 1) Check was called with arguments: (('CMDINFO1=value1', 'CMDINFO2=VALUE2'), ('whoami', '--help'), ('USER_ENV1=VALUE1', 'USER_ENV2=value2'))
(APPROVAL 2) Check was called with arguments: (('CMDINFO1=value1', 'CMDINFO2=VALUE2'), ('whoami', '--help'), ('USER_ENV1=VALUE1', 'USER_ENV2=value2'))
(APPROVAL 1) Destructed successfully
(APPROVAL 2) Destructed successfully