summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2017-03-14 15:34:57 +0100
committerJakub Hrozek <jhrozek@redhat.com>2017-03-27 09:58:40 +0200
commitc9db8b8b19827c3d492b8d2769aa77a37dbc12d3 (patch)
tree16a80ecdd3478ba6dfc03b667628439e52540a13 /src/tests
parent60612b5fbdaaa62ebe6c7f4c27200316f08506d6 (diff)
downloadsssd-c9db8b8b19827c3d492b8d2769aa77a37dbc12d3.tar.gz
sssd-c9db8b8b19827c3d492b8d2769aa77a37dbc12d3.tar.xz
sssd-c9db8b8b19827c3d492b8d2769aa77a37dbc12d3.zip
TCURL: Support HTTP POST for creating containers
The curl integration must allow us to create containers, therefore we also add support of the POST HTTP request type. Reviewed-by: Michal Židek <mzidek@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/intg/test_secrets.py28
-rw-r--r--src/tests/tcurl_test_tool.c5
2 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/intg/test_secrets.py b/src/tests/intg/test_secrets.py
index cbc1a1f06..d71c19045 100644
--- a/src/tests/intg/test_secrets.py
+++ b/src/tests/intg/test_secrets.py
@@ -271,6 +271,34 @@ def test_curlwrap_crd_ops(setup_for_secrets,
'http://localhost/secrets/foo'],
404)
+ # Create a container
+ run_curlwrap_tool([curlwrap_tool, '-o',
+ '-v', '-s', sock_path,
+ 'http://localhost/secrets/cont/'],
+ 200)
+
+ # set a secret foo:bar
+ run_curlwrap_tool([curlwrap_tool, '-p',
+ '-v', '-s', sock_path,
+ 'http://localhost/secrets/cont/cfoo',
+ 'foo_under_cont'],
+ 200)
+
+ # list secrets
+ output = run_curlwrap_tool([curlwrap_tool,
+ '-v', '-s', sock_path,
+ 'http://localhost/secrets/cont/'],
+ 200)
+ assert "cfoo" in output
+
+ # get the foo secret
+ output = run_curlwrap_tool([curlwrap_tool,
+ '-v', '-s', sock_path,
+ 'http://localhost/secrets/cont/cfoo'],
+ 200)
+ assert "foo_under_cont" in output
+
+
def test_curlwrap_parallel(setup_for_secrets,
curlwrap_tool):
diff --git a/src/tests/tcurl_test_tool.c b/src/tests/tcurl_test_tool.c
index 38cea4328..2af950ebb 100644
--- a/src/tests/tcurl_test_tool.c
+++ b/src/tests/tcurl_test_tool.c
@@ -88,6 +88,7 @@ int main(int argc, const char *argv[])
{ "get", 'g', POPT_ARG_NONE, NULL, 'g', "Perform a HTTP GET (default)", NULL },
{ "put", 'p', POPT_ARG_NONE, NULL, 'p', "Perform a HTTP PUT", NULL },
{ "del", 'd', POPT_ARG_NONE, NULL, 'd', "Perform a HTTP DELETE", NULL },
+ { "post", 'o', POPT_ARG_NONE, NULL, 'o', "Perform a HTTP POST", NULL },
{ "verbose", 'v', POPT_ARG_NONE, NULL, 'v', "Print response code and body", NULL },
POPT_TABLEEND
};
@@ -118,6 +119,9 @@ int main(int argc, const char *argv[])
case 'd':
req_type = TCURL_HTTP_DELETE;
break;
+ case 'o':
+ req_type = TCURL_HTTP_POST;
+ break;
case 'v':
pc_verbose = 1;
break;
@@ -145,6 +149,7 @@ int main(int argc, const char *argv[])
switch (req_type) {
case TCURL_HTTP_GET:
case TCURL_HTTP_DELETE:
+ case TCURL_HTTP_POST:
urls[n_reqs++] = extra_arg_ptr;
break;
case TCURL_HTTP_PUT: