summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-01-22 18:11:26 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-01-23 18:41:31 +0000
commit6da1aaf291243c6180bf72d2b88034b8e9f0f74b (patch)
tree607bb9e9f3145c0502ed858a03c38a4083c9f41c
parentUpdate to HTTPS links (diff)
downloadgentoobrowse-6da1aaf291243c6180bf72d2b88034b8e9f0f74b.tar.bz2
gentoobrowse-6da1aaf291243c6180bf72d2b88034b8e9f0f74b.tar.xz
gentoobrowse-6da1aaf291243c6180bf72d2b88034b8e9f0f74b.zip
Test sitemap
-rw-r--r--gentoobrowse/src/Jamfile.jam1
-rw-r--r--gentoobrowse/src/test.cpp27
2 files changed, 27 insertions, 1 deletions
diff --git a/gentoobrowse/src/Jamfile.jam b/gentoobrowse/src/Jamfile.jam
index 8cfc295..f480770 100644
--- a/gentoobrowse/src/Jamfile.jam
+++ b/gentoobrowse/src/Jamfile.jam
@@ -86,6 +86,7 @@ run
<slicer>yes
<library>boost_filesystem
<library>tidy
+ <library>../..//libxmlpp
<library>icespider-testing
<library>boost_unit_test_framework
: gentoobrowse-test ;
diff --git a/gentoobrowse/src/test.cpp b/gentoobrowse/src/test.cpp
index d593ea1..44fa32e 100644
--- a/gentoobrowse/src/test.cpp
+++ b/gentoobrowse/src/test.cpp
@@ -6,6 +6,7 @@
#include <boost/filesystem/operations.hpp>
#include <testRequest.h>
#include <tidy.h>
+#include <libxml++/parsers/domparser.h>
using namespace IceSpider;
@@ -24,7 +25,7 @@ class ChromiumRequest : public TestRequest {
hdr["Accept-Language"] = "en-GB,en;q=0.8";
}
- void standardAssertions(const char * name)
+ virtual void standardAssertions(const char * name)
{
auto h = getResponseHeaders();
BOOST_REQUIRE_EQUAL(h["Status"], "200 OK");
@@ -47,6 +48,23 @@ class ChromiumRequest : public TestRequest {
}
};
+class ChromiumRequestXml : public ChromiumRequest {
+ public:
+ ChromiumRequestXml(const Core * c, HttpMethod m, const std::string & p) :
+ ChromiumRequest(c, m, p)
+ {
+ hdr["Accept"] = "application/xml";
+ }
+
+ virtual void standardAssertions(const char *)
+ {
+ auto h = getResponseHeaders();
+ BOOST_REQUIRE_EQUAL(h["Status"], "200 OK");
+ xmlpp::DomParser p;
+ p.parse_stream(this->output);
+ }
+};
+
BOOST_AUTO_TEST_CASE( cd )
{
boost::filesystem::current_path(rootDir.parent_path());
@@ -131,5 +149,12 @@ BOOST_AUTO_TEST_CASE( search_default )
request.standardAssertions(typeid(this).name());
}
+BOOST_AUTO_TEST_CASE( search_sitemap )
+{
+ ChromiumRequestXml request(this, HttpMethod::GET, "/sitemap.xml");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
BOOST_AUTO_TEST_SUITE_END();