Tests cover --auth-password-file flag usage.
--- /dev/null
+bar
\ No newline at end of file
--- /dev/null
+meow
\ No newline at end of file
shell_command_test "shell.authorized" \
"--auth-user pet --auth-password meow" "list-commands" "" \
"[ { \"arguments\": [ \"build-report\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"list-commands\", \"shutdown\", \"status-get\", \"version-get\" ], \"result\": 0 } ]"
+shell_command_test "shell.bad-auth-password-file" \
+ "--auth-user foo --auth-password-file test" "list-commands" "fail" \
+ "Failed to run: [Errno 2] No such file or directory: 'test'"
+shell_command_test "shell.bad-auth-password-file-content" \
+ "--auth-user foo --auth-password-file ${tmpfile_path}/auth_bad_password_file" "list-commands" "fail" \
+ "Failed to run: HTTP Error 401: Unauthorized"
+shell_command_test "shell.good-auth-password-file-content" \
+ "--auth-user pet --auth-password-file ${tmpfile_path}/auth_password_file" "list-commands" "" \
+ "[ { \"arguments\": [ \"build-report\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"list-commands\", \"shutdown\", \"status-get\", \"version-get\" ], \"result\": 0 } ]"
shell_command_test "shell.authorized" \
"--auth-user pet --auth-password meow" "list-commands" "" \
"[ { \"arguments\": [ \"build-report\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"list-commands\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-reset\", \"statistic-reset-all\", \"status-get\", \"version-get\" ], \"result\": 0 } ]"
+shell_command_test "shell.bad-auth-password-file" \
+ "--auth-user foo --auth-password-file test" "list-commands" "fail" \
+ "Failed to run: [Errno 2] No such file or directory: 'test'"
+shell_command_test "shell.bad-auth-password-file-content" \
+ "--auth-user foo --auth-password-file ${tmpfile_path}/auth_bad_password_file" "list-commands" "fail" \
+ "Failed to run: HTTP Error 401: Unauthorized"
+shell_command_test "shell.good-auth-password-file-content" \
+ "--auth-user pet --auth-password-file ${tmpfile_path}/auth_password_file" "list-commands" "" \
+ "[ { \"arguments\": [ \"build-report\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"list-commands\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-reset\", \"statistic-reset-all\", \"status-get\", \"version-get\" ], \"result\": 0 } ]"
shell_command_test "shell.authorized" \
"--auth-user pet --auth-password meow" "list-commands" "" \
"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+shell_command_test "shell.bad-auth-password-file" \
+ "--auth-user foo --auth-password-file test" "list-commands" "fail" \
+ "Failed to run: [Errno 2] No such file or directory: 'test'"
+shell_command_test "shell.bad-auth-password-file-content" \
+ "--auth-user foo --auth-password-file ${tmpfile_path}/auth_bad_password_file" "list-commands" "fail" \
+ "Failed to run: HTTP Error 401: Unauthorized"
+shell_command_test "shell.good-auth-password-file-content" \
+ "--auth-user pet --auth-password-file ${tmpfile_path}/auth_password_file" "list-commands" "" \
+ "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]"
shell_command_test "shell.authorized" \
"--auth-user pet --auth-password meow" "list-commands" "" \
"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
+shell_command_test "shell.bad-auth-password-file" \
+ "--auth-user foo --auth-password-file test" "list-commands" "fail" \
+ "Failed to run: [Errno 2] No such file or directory: 'test'"
+shell_command_test "shell.bad-auth-password-file-content" \
+ "--auth-user foo --auth-password-file ${tmpfile_path}/auth_bad_password_file" "list-commands" "fail" \
+ "Failed to run: HTTP Error 401: Unauthorized"
+shell_command_test "shell.good-auth-password-file-content" \
+ "--auth-user pet --auth-password-file ${tmpfile_path}/auth_password_file" "list-commands" "" \
+ "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]"
priority: -1,
suite: 'shell-tests',
)
+auth_bad_password_file = configure_file(
+ input: 'auth_bad_password_file.in',
+ output: 'auth_bad_password_file',
+ configuration: shell_tests_conf_data,
+)
+auth_password_file = configure_file(
+ input: 'auth_password_file.in',
+ output: 'auth_password_file',
+ configuration: shell_tests_conf_data,
+)