From 55f4c155e993220333ab281451299a2625c42bd2 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Sun, 22 Feb 2009 22:49:05 +0100 Subject: [PATCH] - add two remote web test cases --- tests/zypp/MediaSetAccess_test.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/zypp/MediaSetAccess_test.cc b/tests/zypp/MediaSetAccess_test.cc index 7889010..c9efc6e 100644 --- a/tests/zypp/MediaSetAccess_test.cc +++ b/tests/zypp/MediaSetAccess_test.cc @@ -6,6 +6,7 @@ #include "zypp/MediaSetAccess.h" #include "zypp/Url.h" +#include "zypp/PathInfo.h" #include "WebServer.h" @@ -14,7 +15,7 @@ using std::endl; using std::string; using namespace zypp; using namespace boost::unit_test; - +using namespace zypp::filesystem; class SimpleVerifier : public media::MediaVerifierBase { @@ -261,7 +262,7 @@ BOOST_AUTO_TEST_CASE(msa_file_exist_local) /* * file exists remote */ -BOOST_AUTO_TEST_CASE(msa_file_exist_remote) +BOOST_AUTO_TEST_CASE(msa_remote_tests) { WebServer web( DATADIR / "/src1/cd1", 10002 ); web.start(); @@ -270,6 +271,12 @@ BOOST_AUTO_TEST_CASE(msa_file_exist_remote) BOOST_CHECK(!setaccess.doesFileExist("/testBADNAME.txt")); BOOST_CHECK(setaccess.doesFileExist("/test.txt")); + // check providing a file via http works + Pathname local = setaccess.provideFile("/test.txt"); + BOOST_CHECK(CheckSum::sha1(sha1sum(local)) == CheckSum::sha1("2616e23301d7fcf7ac3324142f8c748cd0b6692b")); + + // providing a file which does not exist should throw + BOOST_CHECK_THROW(setaccess.provideFile("/testBADNAME.txt"), media::MediaFileNotFoundException); web.stop(); } -- 2.7.4