From 6604764e5f31075a05280520c07c84b0962109a1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 23 Dec 2016 16:21:53 +0000 Subject: Write email payloads to bin dir and validate HTML with tidy --- gentoobrowse-api/unittests/testNotifications.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gentoobrowse-api/unittests/testNotifications.cpp b/gentoobrowse-api/unittests/testNotifications.cpp index 81b28d0..45feb1a 100644 --- a/gentoobrowse-api/unittests/testNotifications.cpp +++ b/gentoobrowse-api/unittests/testNotifications.cpp @@ -2,6 +2,7 @@ #include #include "mockDefs.h" +#include #include BOOST_GLOBAL_FIXTURE( Service ); @@ -17,10 +18,15 @@ isHtml(const std::string & body) void save(const std::string & name, Gentoo::EmailPtr e) { - std::ofstream text("/tmp/" + name + ".txt"); + std::ofstream text((binDir / (name + ".txt")).string()); text << e->body[0]->payload; - std::ofstream html("/tmp/" + name + ".html"); - html << e->body[1]->payload; + + char buf[BUFSIZ]; + sprintf(buf, "tidy --indent yes --wrap 0 -quiet -output %s/%s.html", + binDir.c_str(), name.c_str()); + FILE * tidy = popen(buf, "w"); + BOOST_REQUIRE_EQUAL(1, fwrite(e->body[1]->payload.c_str(), e->body[1]->payload.length(), 1, tidy)); + BOOST_REQUIRE_EQUAL(0, pclose(tidy)); } void -- cgit v1.2.3