- add two remote web test cases
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Sun, 22 Feb 2009 21:49:05 +0000 (22:49 +0100)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Sun, 22 Feb 2009 21:49:05 +0000 (22:49 +0100)
tests/zypp/MediaSetAccess_test.cc

index 7889010..c9efc6e 100644 (file)
@@ -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();
 }