diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-01-22 18:23:44 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-01-23 18:41:31 +0000 |
commit | 45654c409b0f6e2ebbaee6f03278d44659427556 (patch) | |
tree | ecb88207cd2e9685922fb018d74bfebbcbadf0f3 | |
parent | Test sitemap (diff) | |
download | gentoobrowse-45654c409b0f6e2ebbaee6f03278d44659427556.tar.bz2 gentoobrowse-45654c409b0f6e2ebbaee6f03278d44659427556.tar.xz gentoobrowse-45654c409b0f6e2ebbaee6f03278d44659427556.zip |
Add tests for atoms
-rw-r--r-- | gentoobrowse/src/test.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/gentoobrowse/src/test.cpp b/gentoobrowse/src/test.cpp index 44fa32e..1841721 100644 --- a/gentoobrowse/src/test.cpp +++ b/gentoobrowse/src/test.cpp @@ -56,10 +56,29 @@ class ChromiumRequestXml : public ChromiumRequest { hdr["Accept"] = "application/xml"; } - virtual void standardAssertions(const char *) + virtual void standardAssertions(const char *) override { auto h = getResponseHeaders(); BOOST_REQUIRE_EQUAL(h["Status"], "200 OK"); + BOOST_REQUIRE_EQUAL(h["Content-Type"], "application/xml"); + xmlpp::DomParser p; + p.parse_stream(this->output); + } +}; + +class ChromiumRequestAtom : public ChromiumRequest { + public: + ChromiumRequestAtom(const Core * c, HttpMethod m, const std::string & p) : + ChromiumRequest(c, m, p) + { + hdr["Accept"] = "application/atom+xml"; + } + + virtual void standardAssertions(const char *) override + { + auto h = getResponseHeaders(); + BOOST_REQUIRE_EQUAL(h["Status"], "200 OK"); + BOOST_REQUIRE_EQUAL(h["Content-Type"], "application/atom+xml"); xmlpp::DomParser p; p.parse_stream(this->output); } @@ -156,5 +175,26 @@ BOOST_AUTO_TEST_CASE( search_sitemap ) request.standardAssertions(typeid(this).name()); } +BOOST_AUTO_TEST_CASE( home_atom ) +{ + ChromiumRequestAtom request(this, HttpMethod::GET, "/"); + process(&request); + request.standardAssertions(typeid(this).name()); +} + +BOOST_AUTO_TEST_CASE( news_atom ) +{ + ChromiumRequestAtom request(this, HttpMethod::GET, "/news"); + process(&request); + request.standardAssertions(typeid(this).name()); +} + +BOOST_AUTO_TEST_CASE( user_atom ) +{ + ChromiumRequestAtom request(this, HttpMethod::GET, "/atom/randomdan"); + process(&request); + request.standardAssertions(typeid(this).name()); +} + BOOST_AUTO_TEST_SUITE_END(); |