#include "zypp/MediaSetAccess.h"
#include "zypp/Url.h"
+#include "zypp/PathInfo.h"
#include "WebServer.h"
using std::string;
using namespace zypp;
using namespace boost::unit_test;
-
+using namespace zypp::filesystem;
class SimpleVerifier : public media::MediaVerifierBase
{
/*
* 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();
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();
}