// --no-daemon runs the Telegram service inside the UI process (SPEC section 5). Offline part: the keys it needs and the help text. The // connected run against the real account is recorded in README.md (Verified live) and BUILD-TRACK.md. #include #include #include #include #include "tttest.hpp" #include "ptychild.hpp" using ptytest::binDir; namespace { struct TempDir { std::string path; TempDir() { char t[] = "/tmp/mologram-nodaemon-XXXXXX"; path = mkdtemp(t); } ~TempDir() { std::error_code ec; std::filesystem::remove_all(path, ec); } }; std::string slurp(const std::string& p) { std::ifstream in(p); return std::string((std::istreambuf_iterator(in)), std::istreambuf_iterator()); } } // namespace TEST_CASE("--no-daemon needs the account keys and says which are missing; --help names the process options", "[process][nodaemon][integration]") { TempDir d; std::string cfg = d.path + "/cfg.json"; { std::ofstream f(cfg); f << "{\"data_dir\":\"" << d.path << "\"}"; } std::string out = d.path + "/out.txt"; int rc = std::system((binDir() + "/mologram --no-daemon --config " + cfg + " > " + out + " 2>&1").c_str()); std::string text = slurp(out); CHECK(WIFEXITED(rc)); CHECK_EQ(WEXITSTATUS(rc), 2); CHECK(text.find("required config keys missing") != std::string::npos); CHECK(text.find("api_hash") != std::string::npos); CHECK_EQ(std::system((binDir() + "/mologram --help > " + out + " 2>&1").c_str()), 0); std::string help = slurp(out); CHECK(help.find("--no-daemon") != std::string::npos); CHECK(help.find("--fake-daemon") != std::string::npos); }