// Route: POST /doos/delete (dry run unless confirm=yes) #include "support/Assert.hpp" #include "support/DoosHome.hpp" using namespace molo::example::test; int main() { ScratchDoosHome home("delete"); Fixture f; auto made = f.client->post("/doos/create", "name=temp1", "application/x-www-form-urlencoded"); check(made.status == 200, "create 200"); auto dry = f.client->post("/doos/delete", "name=temp1", "application/x-www-form-urlencoded"); check(dry.status == 200, "dry run 200"); check(contains(dry.body, "\"dry_run\":true"), "dry run without confirm"); check(contains(dry.body, "dry run"), "report text"); auto still = f.client->get("/doos/status"); check(contains(still.body, "\"name\":\"temp1\""), "dry run deletes nothing"); auto gone = f.client->post("/doos/delete", "name=temp1&confirm=yes", "application/x-www-form-urlencoded"); check(contains(gone.body, "\"dry_run\":false"), "confirm deletes"); auto after = f.client->get("/doos/status"); check(!contains(after.body, "\"name\":\"temp1\""), "container gone after confirm"); auto missing = f.client->post("/doos/delete", "name=temp1&confirm=yes", "application/x-www-form-urlencoded"); check(missing.status == 404, "missing container is 404"); auto noname = f.client->post("/doos/delete", "confirm=yes", "application/x-www-form-urlencoded"); check(noname.status == 422, "missing name rejected"); return finish("doos/delete"); }