diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-12-23 16:21:53 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-12-27 17:16:14 +0000 |
commit | 6604764e5f31075a05280520c07c84b0962109a1 (patch) | |
tree | 0d7ab928fcf54760f48a638681d1db38bcaa2934 | |
parent | Fix empty i in HTML emails (diff) | |
download | gentoobrowse-api-6604764e5f31075a05280520c07c84b0962109a1.tar.bz2 gentoobrowse-api-6604764e5f31075a05280520c07c84b0962109a1.tar.xz gentoobrowse-api-6604764e5f31075a05280520c07c84b0962109a1.zip |
Write email payloads to bin dir and validate HTML with tidy
-rw-r--r-- | gentoobrowse-api/unittests/testNotifications.cpp | 12 |
1 files 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 <boost/test/unit_test.hpp> #include "mockDefs.h" +#include <definedDirs.h> #include <fstream> 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 |