From 6e292051de2f5864322f8774c523070501e4346c Mon Sep 17 00:00:00 2001 From: bel Date: Thu, 30 Jul 2015 22:25:17 +0200 Subject: [PATCH] Add unauthorized PUT unit test --- test/public.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/public.c b/test/public.c index 57c3f459..6cf0f09b 100644 --- a/test/public.c +++ b/test/public.c @@ -669,6 +669,22 @@ START_TEST(test_request_handlers) mg_close_connection(conn); + /* PUT to static file (will not work) */ + conn = mg_download("localhost", + atoi(HTTP_PORT), + 0, + ebuf, + sizeof(ebuf), + "%s", + "PUT /test.txt HTTP/1.0\r\n\r\n"); + ck_assert(conn != NULL); + ri = mg_get_request_info(conn); + + ck_assert(ri != NULL); + ck_assert_str_eq(ri->uri, "401"); /* not authorized */ + mg_close_connection(conn); + + /* Close the server */ g_ctx = NULL; mg_stop(ctx); @@ -724,7 +740,7 @@ Suite *make_public_suite(void) return suite; } -#if 1 +#if 0 /* Used to debug test cases without using the check framework */ void main(void) {