Files
moloapp/tests/example/auth/login_test.cpp
T
retoor 3c4334cec9 feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security,
data, app, realtime, supervisor, clients, CLI, example plus
enterprise tenancy, audit, operability, governance,
supplychain. Postgres via docker compose for tests.
2026-10-23 18:20:04 +02:00

23 lines
883 B
C++

// Route: POST /auth/login
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
Fixture f;
auto ok = f.client->post("/auth/login",
"{\"username\":\"ada\",\"password\":"
"\"correct-horse\"}",
"application/json");
check(ok.status == 200, "good credentials are 200");
check(contains(ok.body, "\"user\":\"ada\""), "username echoed");
auto bad = f.client->post("/auth/login",
"{\"username\":\"ada\",\"password\":\"wrong\"}",
"application/json");
check(bad.status == 403, "bad password is 403");
auto missing = f.client->post("/auth/login", "{\"username\":\"ada\"}",
"application/json");
check(missing.status == 400, "missing field is 400");
return finish("auth/login");
}