From 43020936841e2a9ccb4b1d88acea0b1c864840c2 Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 25 Apr 2019 16:24:02 +0200 Subject: [PATCH] Added tests for POST API::v1::lists. --- tests/test_api_v1_lists.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/test_api_v1_lists.cpp b/tests/test_api_v1_lists.cpp index f77acd0..9d31e9d 100644 --- a/tests/test_api_v1_lists.cpp +++ b/tests/test_api_v1_lists.cpp @@ -71,6 +71,35 @@ SCENARIO ("/api/v1/lists can be called successfully", REQUIRE(list.id() != ""); } } + + WHEN ("POST /api/v1/lists is called") + { + try + { + ret = masto.post(API::v1::lists, + {{ "title", { "testlist" }}}); + list.from_string(ret.answer); + } + catch (const std::exception &e) + { + exception = true; + WARN(e.what()); + } + + THEN("No exception is thrown") + AND_THEN ("No errors are returned") + AND_THEN ("Answer is valid") + AND_THEN ("The answer makes sense") + { + REQUIRE_FALSE(exception); + + REQUIRE(ret.error_code == 0); + REQUIRE(ret.http_error_code == 200); + REQUIRE(list.valid()); + + REQUIRE(list.id() != ""); + } + } } }