From 136c4c90970edfb54531383464dee45ca58ebe56 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Fri, 7 Jul 2006 13:20:46 +0000 Subject: [PATCH] - new testcases for core classes - ported some of the old ones to boost:test - PublicKey test, embed the key in the code because I have no idea to know the path of a file from a testcase --- devel/devel.dmacvicar/knownsources.cc | 48 ++++++ testsuite/zypp/lib/libzypp_init.exp | 2 + testsuite/zypp/tests/Arch.cc | 55 +++---- testsuite/zypp/tests/Capabilities.cc | 50 +++--- testsuite/zypp/tests/Digest.cc | 52 +++++++ testsuite/zypp/tests/Edition.cc | 57 +++---- testsuite/zypp/tests/Makefile.am | 29 +++- testsuite/zypp/tests/PathInfo.cc | 62 ++++++++ testsuite/zypp/tests/PublicKey.cc | 251 +++++++++++++++++++++++++++--- testsuite/zypp/tests/Signature.cc | 30 ++++ testsuite/zypp/tests/publickey-1.asc | 24 --- testsuite/zypp/tests/publickey-suse.asc | 37 ----- testsuite/zypp/zypp.test/Capabilities.exp | 4 + testsuite/zypp/zypp.test/CheckSum.exp | 1 + testsuite/zypp/zypp.test/PathInfo.exp | 1 + testsuite/zypp/zypp.test/Signature.exp | 2 + zypp/Makefile.am | 2 + zypp/MediaSetAccess.cc | 11 ++ zypp/MediaSetAccess.h | 8 +- zypp/Signature.cc | 30 ++++ zypp/Signature.h | 37 +++++ 21 files changed, 625 insertions(+), 168 deletions(-) create mode 100644 devel/devel.dmacvicar/knownsources.cc create mode 100644 testsuite/zypp/tests/Digest.cc create mode 100644 testsuite/zypp/tests/PathInfo.cc create mode 100644 testsuite/zypp/tests/Signature.cc delete mode 100644 testsuite/zypp/tests/publickey-1.asc delete mode 100644 testsuite/zypp/tests/publickey-suse.asc create mode 100644 testsuite/zypp/zypp.test/Capabilities.exp create mode 100644 testsuite/zypp/zypp.test/CheckSum.exp create mode 100644 testsuite/zypp/zypp.test/PathInfo.exp create mode 100644 testsuite/zypp/zypp.test/Signature.exp create mode 100644 zypp/Signature.cc create mode 100644 zypp/Signature.h diff --git a/devel/devel.dmacvicar/knownsources.cc b/devel/devel.dmacvicar/knownsources.cc new file mode 100644 index 0000000..bf613a2 --- /dev/null +++ b/devel/devel.dmacvicar/knownsources.cc @@ -0,0 +1,48 @@ +#include +#include +#include +#include + +#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp +#include "boost/filesystem/fstream.hpp" // ditto + +#include + +#include +#include +#include +#include +#include +/////////////////////////////////////////////////////////////////// + +#include + + +#include +#include + +#include "zypp/CapFactory.h" +#include "zypp/KeyRing.h" +#include "zypp/PublicKey.h" + +#include "zypp/cache/KnownSourcesCache.h" + +using namespace zypp::detail; + +using namespace std; +using namespace zypp; + +//using namespace DbXml; + +int main() +{ + cache::KnownSourcesCache cache("/"); + + source::SourceInfoList srcs = cache.knownSources(); + for ( source::SourceInfoList::const_iterator it = srcs.begin(); it != srcs.end(); ++it) + { + cout << *it << endl; + } +} + + diff --git a/testsuite/zypp/lib/libzypp_init.exp b/testsuite/zypp/lib/libzypp_init.exp index 251ec2a..2c1e254 100644 --- a/testsuite/zypp/lib/libzypp_init.exp +++ b/testsuite/zypp/lib/libzypp_init.exp @@ -42,12 +42,14 @@ proc runBinary { prog {path ""} {expected_result 0} } { # expect prog to pass proc shouldPass { prog {path ""} } { + setenv "ZYPP_TEST_BASE" $path return [runBinary $prog $path 0] } # expect prog to fail proc shouldFail { prog {path ""} } { + setenv "ZYPP_TEST_BASE" $path return [runBinary $prog $path 1] } diff --git a/testsuite/zypp/tests/Arch.cc b/testsuite/zypp/tests/Arch.cc index 1301cda..075872a 100644 --- a/testsuite/zypp/tests/Arch.cc +++ b/testsuite/zypp/tests/Arch.cc @@ -10,20 +10,17 @@ #include "zypp/base/Logger.h" #include "zypp/Arch.h" +// Boost.Test +#include +#include + +using boost::unit_test::test_suite; +using boost::unit_test::test_case; +using boost::test_tools::close_at_tolerance; + using namespace std; using namespace zypp; -static int -arch_exception () -{ - try { - Arch _arch1(NULL); // bad value, should raise exception - } catch (exception exp) { - return 0; // exception raised - } - return 1; // no exception -} - /****************************************************************** ** ** @@ -32,27 +29,25 @@ arch_exception () ** ** DESCRIPTION : */ -int main( int argc, char * argv[] ) +void arch_test() { Arch _arch32( "i386" ); - if (_arch32 != Arch_i386) return 1; - - if (_arch32.asString() != string("i386")) return 2; - - if (!_arch32.compatibleWith (Arch_x86_64)) return 3; - - if (arch_exception() != 0) return 4; - - if ( Arch() != Arch_noarch ) return 5; - - if ( Arch("") == Arch_noarch ) return 6; - - if ( ! Arch("").empty() ) return 7; - - if ( Arch_noarch.empty() ) return 8; - - if (_arch32.compare(Arch_x86_64) >= 0) return 9; + BOOST_CHECK_EQUAL( _arch32, Arch_i386 ); + BOOST_CHECK_EQUAL( _arch32.asString(), string("i386")); + BOOST_REQUIRE( _arch32.compatibleWith (Arch_x86_64)); + BOOST_CHECK_THROW( Arch(NULL), exception); + BOOST_CHECK_EQUAL( Arch(), Arch_noarch ); + BOOST_REQUIRE( Arch("") != Arch_noarch ); + BOOST_REQUIRE( Arch("").empty() ); + BOOST_REQUIRE( ! Arch_noarch.empty() ); + BOOST_REQUIRE( ! ( _arch32.compare(Arch_x86_64) >= 0) ); +} - return 0; +test_suite* +init_unit_test_suite( int, char* [] ) +{ + test_suite* test= BOOST_TEST_SUITE( "ArchTest" ); + test->add( BOOST_TEST_CASE( &arch_test ), 0 /* expected zero error */ ); + return test; } diff --git a/testsuite/zypp/tests/Capabilities.cc b/testsuite/zypp/tests/Capabilities.cc index fb8d45f..35c1f16 100644 --- a/testsuite/zypp/tests/Capabilities.cc +++ b/testsuite/zypp/tests/Capabilities.cc @@ -4,45 +4,59 @@ // #include +// Boost.Test +#include +#include + #include "zypp/base/Logger.h" #include "zypp/CapFactory.h" +using boost::unit_test::test_suite; +using boost::unit_test::test_case; +using boost::test_tools::close_at_tolerance; + using namespace std; using namespace zypp; -int main( int argc, char * argv[] ) +void capabilities_test() { Resolvable::Kind kind = ResTraits::kind; CapFactory factory; Edition edition ("1.0", "42"); Capability cap = factory.parse ( kind, "foo", "=", "1.0-42"); - if (cap.asString() != "foo == 1.0-42") return 1; - if (cap.index() != "foo") return 2; - if (cap.op() != Rel::EQ) return 3; - if (cap.edition() != edition) return 4; + BOOST_CHECK_EQUAL( cap.asString(), "foo == 1.0-42" ); + BOOST_CHECK_EQUAL( cap.index(), "foo"); + BOOST_CHECK_EQUAL( cap.op(), Rel::EQ); + BOOST_CHECK_EQUAL( cap.edition(), edition); Capability cap2 = factory.parse ( kind, "foo", Rel::EQ, edition); - if (cap2.index() != cap.index()) return 10; - if (cap2.op() != cap.op()) return 11; - if (cap2.edition() != cap.edition()) return 12; + BOOST_CHECK_EQUAL( cap2.index(), cap.index()); + BOOST_CHECK_EQUAL( cap2.op(), cap.op()); + BOOST_CHECK_EQUAL( cap2.edition(), cap.edition()); Capability cap3 = factory.parse ( kind, "foo = 1.0-42"); - if (cap3.index() != cap.index()) return 20; - if (cap3.op() != cap.op()) return 21; - if (cap3.edition() != cap.edition()) return 22; + BOOST_CHECK_EQUAL( cap3.index(), cap.index()); + BOOST_CHECK_EQUAL( cap3.op(), cap.op()); + BOOST_CHECK_EQUAL( cap3.edition(), cap.edition()); string bash = "/bin/bash"; Capability cap4 = factory.parse ( kind, bash); - if (cap4.index() != bash) return 30; - if (cap4.op() != Rel::NONE) return 31; - if (cap4.edition() != Edition::noedition) return 32; + BOOST_CHECK_EQUAL(cap4.index(), bash); + BOOST_CHECK_EQUAL(cap4.op(), Rel::NONE); + BOOST_CHECK_EQUAL(cap4.edition(), Edition::noedition); string hal = "hal(smp)"; Capability cap5 = factory.parse ( kind, hal); - if (cap5.index() != hal) return 40; - if (cap5.op() != Rel::NONE) return 41; - if (cap5.edition() != Edition::noedition) return 42; + BOOST_CHECK_EQUAL(cap5.index(), hal); + BOOST_CHECK_EQUAL(cap5.op(), Rel::NONE); + BOOST_CHECK_EQUAL(cap5.edition(), Edition::noedition); +} - return 0; +test_suite* +init_unit_test_suite( int, char* [] ) +{ + test_suite* test= BOOST_TEST_SUITE( "CapabilitiesTest" ); + test->add( BOOST_TEST_CASE( &capabilities_test ), 0 /* expected zero error */ ); + return test; } diff --git a/testsuite/zypp/tests/Digest.cc b/testsuite/zypp/tests/Digest.cc new file mode 100644 index 0000000..8e7ef63 --- /dev/null +++ b/testsuite/zypp/tests/Digest.cc @@ -0,0 +1,52 @@ + +#include +#include +#include +#include +#include + +// Boost.Test +#include +#include + +using boost::unit_test::test_suite; +using boost::unit_test::test_case; +using boost::test_tools::close_at_tolerance; + +// parameterized test +// http://www.boost.org/libs/test/example/unit_test_example4.cpp + +#include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" +#include "zypp/PathInfo.h" +#include "zypp/Digest.h" + +using namespace std; +using namespace zypp; +using namespace zypp::filesystem; + +/** + * Test case for + * static std::string digest(const std::string& name, std::istream& is, size_t bufsize = 4096); + */ +void digest_test() +{ + string data("I will test the checksum of this"); + stringstream str1(data); + stringstream str2(data); + stringstream str3(data); + + BOOST_CHECK_EQUAL( Digest::digest( "sha1", str1 ), "142df4277c326f3549520478c188cab6e3b5d042" ); + BOOST_CHECK_EQUAL( Digest::digest( "md5", str2 ), "f139a810b84d82d1f29fc53c5e59beae" ); + // FIXME i think it should throw + BOOST_CHECK_EQUAL( Digest::digest( "lalala", str3) , "" ); +} + +test_suite* +init_unit_test_suite( int, char* [] ) +{ + test_suite* test= BOOST_TEST_SUITE( "DigestTest" ); + test->add( BOOST_TEST_CASE( &digest_test ), 0 /* expected zero error */ ); + return test; +} + diff --git a/testsuite/zypp/tests/Edition.cc b/testsuite/zypp/tests/Edition.cc index a7a6082..2ce32d4 100644 --- a/testsuite/zypp/tests/Edition.cc +++ b/testsuite/zypp/tests/Edition.cc @@ -6,46 +6,39 @@ #include "zypp/base/Logger.h" #include "zypp/Edition.h" +#include + +using boost::unit_test::test_suite; +using boost::unit_test::test_case; + using namespace std; using namespace zypp; -static int -edition_exception (const std::string &value) -{ - try { - Edition _ed(value); // bad value, should raise exception - } catch (exception exp) { - return 0; // exception raised - } - return 1; // no exception -} - -/****************************************************************** -** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -** -** DESCRIPTION : -*/ -int main( int argc, char * argv[] ) +void edition_test() { - if (edition_exception (string("A::foo--foo"))) return 1; + BOOST_CHECK_THROW( Edition(string("A::foo--foo")), exception ); + Edition _ed1 ("1"); Edition _ed2 ("1.1"); Edition _ed3 ("1:1"); Edition _ed4 ("1:1-1"); - if (_ed2.version() != "1.1") return 2; - if (_ed2.release() != "") return 3; - if (_ed2.epoch() != 0) return 4; - if (_ed4.epoch() != 1) return 5; - - if (_ed1 != Edition ("1", "")) return 6; - if (_ed2 != Edition ("1.1", "")) return 7; - if (_ed3 != Edition ("1", "", "1")) return 8; - if (_ed3 != Edition ("1", "", 1)) return 9; - if (_ed4 != Edition ("1", "1", 1)) return 10; + BOOST_CHECK_EQUAL(_ed2.version(), "1.1"); + BOOST_CHECK_EQUAL(_ed2.release(), ""); + BOOST_CHECK_EQUAL(_ed2.epoch(), 0); + BOOST_CHECK_EQUAL(_ed4.epoch(), 1); - return 0; + BOOST_CHECK_EQUAL(_ed1, Edition ("1", "")); + BOOST_CHECK_EQUAL(_ed2, Edition ("1.1", "")); + BOOST_CHECK_EQUAL(_ed3, Edition ("1", "", "1")); + BOOST_CHECK_EQUAL(_ed3, Edition ("1", "", 1)); + BOOST_CHECK_EQUAL(_ed4, Edition ("1", "1", 1)); } + +test_suite* +init_unit_test_suite( int, char* [] ) +{ + test_suite* test= BOOST_TEST_SUITE( "EditionTest" ); + test->add( BOOST_TEST_CASE( &edition_test ), 0 /* expected zero error */ ); + return test; +} \ No newline at end of file diff --git a/testsuite/zypp/tests/Makefile.am b/testsuite/zypp/tests/Makefile.am index 9c2b544..677bc76 100644 --- a/testsuite/zypp/tests/Makefile.am +++ b/testsuite/zypp/tests/Makefile.am @@ -14,29 +14,54 @@ noinst_PROGRAMS = Arch Url1 Url2 Url3 Url4 Url5 Url \ PtrTypes \ TranslatedText \ CheckSum \ - PublicKey + PublicKey \ + PathInfo \ + Digest \ + Signature ## ################################################## -LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la -lboost_unit_test_framework +LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la ## ################################################## Arch_SOURCES = Arch.cc +Arch_LDADD = $(LDADD) -lboost_unit_test_framework + Url1_SOURCES = Url1.cc Url2_SOURCES = Url2.cc Url3_SOURCES = Url3.cc Url4_SOURCES = Url4.cc Url5_SOURCES = Url5.cc Url_SOURCES = Url.cc + TranslatedText_SOURCES = TranslatedText.cc + PublicKey_SOURCES = PublicKey.cc +PublicKey_LDADD = $(LDADD) -lboost_unit_test_framework + CheckSum_SOURCES = CheckSum.cc +CheckSum_LDADD = $(LDADD) -lboost_unit_test_framework + RWPtr_SOURCES = RWPtr.cc + Edition_SOURCES = Edition.cc +Edition_LDADD = $(LDADD) -lboost_unit_test_framework + Capabilities_SOURCES = Capabilities.cc +Capabilities_LDADD = $(LDADD) -lboost_unit_test_framework + PtrTypes_SOURCES = PtrTypes.cc +PathInfo_SOURCES = PathInfo.cc +PathInfo_LDADD = $(LDADD) -lboost_unit_test_framework + +Digest_SOURCES = Digest.cc +Digest_LDADD = $(LDADD) -lboost_unit_test_framework + +Signature_SOURCES = Signature.cc +Signature_LDADD = $(LDADD) -lboost_unit_test_framework + ## ################################################## .PHONY: always diff --git a/testsuite/zypp/tests/PathInfo.cc b/testsuite/zypp/tests/PathInfo.cc new file mode 100644 index 0000000..aec22fd --- /dev/null +++ b/testsuite/zypp/tests/PathInfo.cc @@ -0,0 +1,62 @@ + +#include +#include +#include +#include + +// Boost.Test +#include +#include + +using boost::unit_test::test_suite; +using boost::unit_test::test_case; +using boost::test_tools::close_at_tolerance; + +// parameterized test +// http://www.boost.org/libs/test/example/unit_test_example4.cpp + +#include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" +#include "zypp/PathInfo.h" +#include "zypp/TmpPath.h" + +using namespace std; +using namespace zypp; +using namespace zypp::filesystem; + +/** + * Test case for + * bool is_checksum( const Pathname & file, const CheckSum &checksum ); + * std::string checksum( const Pathname & file, const std::string &algorithm ); + */ +void pathinfo_checksum_test() +{ + const char *buffer = "I will test the checksum of this"; + TmpFile file; + ofstream str(file.path().asString().c_str(),ofstream::out); + + if (!str.good()) + ZYPP_THROW(Exception("cant open file")); + + str << buffer; + str.flush(); + str.close(); + + CheckSum file_sha1("sha1", "142df4277c326f3549520478c188cab6e3b5d042"); + CheckSum file_md5("md5", "f139a810b84d82d1f29fc53c5e59beae"); + + BOOST_CHECK_EQUAL( checksum( file.path(), "sha1"), "142df4277c326f3549520478c188cab6e3b5d042" ); + BOOST_CHECK_EQUAL( checksum( file.path(), "md5"), "f139a810b84d82d1f29fc53c5e59beae" ); + + BOOST_REQUIRE( is_checksum( file.path(), file_sha1 ) ); + BOOST_REQUIRE( is_checksum( file.path(), file_md5 ) ); +} + +test_suite* +init_unit_test_suite( int, char* [] ) +{ + test_suite* test= BOOST_TEST_SUITE( "PathInfoTest" ); + test->add( BOOST_TEST_CASE( &pathinfo_checksum_test ), 0 /* expected zero error */ ); + return test; +} + diff --git a/testsuite/zypp/tests/PublicKey.cc b/testsuite/zypp/tests/PublicKey.cc index 5d1b42a..0bc0137 100644 --- a/testsuite/zypp/tests/PublicKey.cc +++ b/testsuite/zypp/tests/PublicKey.cc @@ -1,13 +1,13 @@ #include +#include #include #include #include "zypp/base/Logger.h" #include "zypp/base/Exception.h" #include "zypp/PublicKey.h" -#include "zypp/ZYppFactory.h" -#include "zypp/ZYpp.h" +#include "zypp/TmpPath.h" #include @@ -17,30 +17,239 @@ using boost::unit_test::test_case; using namespace std; using namespace zypp; -//BOOST_CHECK( m_account.balance() >= 0.0 ); - // BOOST_REQUIRE - //BOOST_CHECK_MESSAGE( m_account.balance() > 1.0, - // "Initial balance should be more then 1, was " << m_account.balance() ); - //BOOST_CHECK_EQUAL( m_account.balance(), 5.0 ); - //BOOST_CHECK_CLOSE( m_account.balance(), 10.0, /* tolerance */ 1e-10 ); - //BOOST_REQUIRE_MESSAGE( m_account.balance() > 500.1, - // "Balance should be more than 500.1, was " << m_account.balance()); +/* +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.2 (GNU/Linux) - //BOOST_REQUIRE_PREDICATE( std::not_equal_to(), (m_account.balance())(999.9) ); - //BOOST_REQUIRE_PREDICATE( close_at_tolerance( 1e-9 ), (m_account.balance())(605.5) ); - // BOOST_CHECK_THROW( m_account.withdraw( m_account.balance() + 1 ), std::runtime_error ); +mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff +4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d +M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO +QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK +XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE +D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd +G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM +CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE +myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr +YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD +BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q +W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe +UgAKCRCeQOMQAAqrp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WpO+M9bHp4d+puY0L +1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ +1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l +/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO +=pJli +-----END PGP PUBLIC KEY BLOCK----- +*/ + +/** + * Array version of the above key + */ +char susekey[]= +{ + 0x2d,0x2d,0x2d,0x2d,0x2d,0x42,0x45,0x47,0x49,0x4e,0x20,0x50,0x47, + 0x50,0x20,0x50,0x55,0x42,0x4c,0x49,0x43,0x20,0x4b,0x45,0x59,0x20, + 0x42,0x4c,0x4f,0x43,0x4b,0x2d,0x2d,0x2d,0x2d,0x2d,0x0a,0x56,0x65, + 0x72,0x73,0x69,0x6f,0x6e,0x3a,0x20,0x47,0x6e,0x75,0x50,0x47,0x20, + 0x76,0x31,0x2e,0x34,0x2e,0x32,0x20,0x28,0x47,0x4e,0x55,0x2f,0x4c, + 0x69,0x6e,0x75,0x78,0x29,0x0a,0x0a,0x6d,0x51,0x47,0x69,0x42,0x44, + 0x6e,0x75,0x39,0x49,0x45,0x52,0x42,0x41,0x43,0x54,0x38,0x59,0x33, + 0x35,0x2b,0x32,0x76,0x76,0x34,0x4d,0x47,0x56,0x4b,0x69,0x4c,0x45, + 0x4d,0x4f,0x6c,0x39,0x47,0x64,0x53,0x54,0x36,0x4d,0x43,0x6b,0x59, + 0x53,0x33,0x79,0x45,0x4b,0x65,0x75,0x65,0x4e,0x57,0x63,0x2b,0x7a, + 0x2f,0x30,0x4b,0x76,0x66,0x66,0x0a,0x34,0x4a,0x63,0x74,0x42,0x73, + 0x67,0x73,0x34,0x37,0x74,0x6a,0x6d,0x69,0x49,0x39,0x73,0x6c,0x30, + 0x65,0x48,0x6a,0x6d,0x33,0x67,0x54,0x52,0x38,0x72,0x49,0x74,0x58, + 0x4d,0x4e,0x36,0x73,0x4a,0x45,0x55,0x48,0x57,0x7a,0x44,0x50,0x2b, + 0x59,0x30,0x50,0x46,0x50,0x62,0x6f,0x4d,0x76,0x4b,0x78,0x30,0x46, + 0x58,0x6c,0x2f,0x41,0x30,0x64,0x0a,0x4d,0x2b,0x48,0x46,0x72,0x72, + 0x75,0x43,0x67,0x42,0x6c,0x57,0x74,0x36,0x46,0x41,0x2b,0x6f,0x6b, + 0x52,0x79,0x53,0x51,0x69,0x6c,0x69,0x75,0x49,0x35,0x70,0x68,0x77, + 0x71,0x6b,0x58,0x65,0x66,0x6c,0x39,0x41,0x68,0x6b,0x77,0x52,0x38, + 0x78,0x6f,0x63,0x51,0x53,0x56,0x43,0x46,0x78,0x63,0x77,0x76,0x77, + 0x43,0x67,0x6c,0x56,0x63,0x4f,0x0a,0x51,0x6c,0x69,0x48,0x75,0x38, + 0x6a,0x77,0x52,0x51,0x48,0x78,0x6c,0x52,0x45,0x30,0x74,0x6b,0x77, + 0x51,0x51,0x49,0x30,0x44,0x2b,0x77,0x66,0x51,0x77,0x4b,0x64,0x76, + 0x68,0x44,0x70,0x6c,0x78,0x48,0x4a,0x35,0x6e,0x66,0x37,0x55,0x38, + 0x63,0x2f,0x79,0x45,0x2f,0x76,0x64,0x76,0x70,0x4e,0x36,0x6c,0x46, + 0x30,0x74,0x6d,0x46,0x72,0x4b,0x0a,0x58,0x42,0x55,0x58,0x2b,0x4b, + 0x37,0x75,0x34,0x69,0x66,0x72,0x5a,0x6c,0x51,0x76,0x6a,0x2f,0x38, + 0x31,0x4d,0x34,0x49,0x4e,0x6a,0x74,0x58,0x72,0x65,0x71,0x44,0x69, + 0x4a,0x74,0x72,0x39,0x39,0x52,0x73,0x36,0x78,0x61,0x30,0x53,0x63, + 0x5a,0x71,0x49,0x54,0x75,0x5a,0x43,0x34,0x43,0x57,0x78,0x4a,0x61, + 0x39,0x47,0x79,0x6e,0x42,0x45,0x0a,0x44,0x33,0x2b,0x44,0x32,0x74, + 0x31,0x56,0x2f,0x66,0x38,0x6c,0x30,0x73,0x6d,0x73,0x75,0x59,0x6f, + 0x46,0x4f,0x46,0x37,0x49,0x62,0x34,0x39,0x49,0x6b,0x54,0x64,0x62, + 0x74,0x77,0x41,0x54,0x68,0x6c,0x5a,0x70,0x38,0x62,0x45,0x68,0x45, + 0x4c,0x42,0x65,0x47,0x61,0x50,0x64,0x4e,0x43,0x63,0x6d,0x66,0x5a, + 0x36,0x36,0x72,0x4b,0x55,0x64,0x0a,0x47,0x35,0x73,0x52,0x41,0x2f, + 0x39,0x6f,0x76,0x6e,0x63,0x31,0x6b,0x72,0x53,0x51,0x46,0x32,0x2b, + 0x73,0x71,0x42,0x39,0x2f,0x6f,0x37,0x77,0x35,0x2f,0x71,0x32,0x71, + 0x69,0x79,0x7a,0x77,0x4f,0x53,0x54,0x6e,0x6b,0x6a,0x74,0x42,0x55, + 0x56,0x4b,0x6e,0x34,0x7a,0x4c,0x55,0x4f,0x66,0x36,0x61,0x65,0x42, + 0x41,0x6f,0x56,0x36,0x4e,0x4d,0x0a,0x43,0x43,0x33,0x4b,0x6a,0x39, + 0x61,0x5a,0x48,0x66,0x41,0x2b,0x4e,0x44,0x30,0x65,0x68,0x50,0x61, + 0x56,0x47,0x4a,0x67,0x6a,0x61,0x56,0x4e,0x46,0x68,0x50,0x69,0x34, + 0x78,0x30,0x65,0x37,0x42,0x55,0x4c,0x64,0x76,0x67,0x4f,0x6f,0x41, + 0x71,0x61,0x6a,0x4c,0x66,0x76,0x6b,0x55,0x52,0x48,0x41,0x65,0x53, + 0x73,0x78,0x58,0x49,0x6f,0x45,0x0a,0x6d,0x79,0x57,0x2f,0x78,0x43, + 0x31,0x73,0x42,0x62,0x44,0x6b,0x44,0x55,0x49,0x42,0x53,0x78,0x35, + 0x6f,0x65,0x6a,0x37,0x33,0x58,0x43,0x5a,0x67,0x6e,0x6a,0x2f,0x69, + 0x6e,0x70,0x68,0x52,0x71,0x47,0x70,0x73,0x62,0x2b,0x31,0x6e,0x4b, + 0x46,0x76,0x46,0x2b,0x72,0x51,0x6f,0x55,0x33,0x56,0x54,0x52,0x53, + 0x42,0x51,0x59,0x57,0x4e,0x72,0x0a,0x59,0x57,0x64,0x6c,0x49,0x46, + 0x4e,0x70,0x5a,0x32,0x35,0x70,0x62,0x6d,0x63,0x67,0x53,0x32,0x56, + 0x35,0x49,0x44,0x78,0x69,0x64,0x57,0x6c,0x73,0x5a,0x45,0x42,0x7a, + 0x64,0x58,0x4e,0x6c,0x4c,0x6d,0x52,0x6c,0x50,0x6f,0x68,0x69,0x42, + 0x42,0x4d,0x52,0x41,0x67,0x41,0x69,0x42,0x51,0x4a,0x41,0x32,0x41, + 0x59,0x2b,0x41,0x68,0x73,0x44,0x0a,0x42,0x51,0x6b,0x4f,0x62,0x64, + 0x2b,0x39,0x42,0x41,0x73,0x48,0x41,0x77,0x49,0x44,0x46,0x51,0x49, + 0x44,0x41,0x78,0x59,0x43,0x41,0x51,0x49,0x65,0x41,0x51,0x49,0x58, + 0x67,0x41,0x41,0x4b,0x43,0x52,0x43,0x6f,0x54,0x74,0x72,0x6f,0x6e, + 0x49,0x41,0x4b,0x79,0x70,0x43,0x66,0x41,0x4a,0x39,0x52,0x75,0x5a, + 0x36,0x5a,0x53,0x56,0x37,0x51,0x0a,0x57,0x34,0x70,0x54,0x67,0x54, + 0x49,0x78,0x51,0x2b,0x41,0x42,0x50,0x70,0x30,0x73,0x49,0x77,0x43, + 0x66,0x66,0x47,0x39,0x62,0x43,0x4e,0x6e,0x72,0x45,0x54,0x50,0x6c, + 0x67,0x4f,0x6e,0x2b,0x64,0x47,0x45,0x6b,0x41,0x57,0x65,0x67,0x4b, + 0x4c,0x2b,0x49,0x52,0x67,0x51,0x51,0x45,0x51,0x49,0x41,0x42,0x67, + 0x55,0x43,0x4f,0x6e,0x42,0x65,0x0a,0x55,0x67,0x41,0x4b,0x43,0x52, + 0x43,0x65,0x51,0x4f,0x4d,0x51,0x41,0x41,0x71,0x72,0x70,0x4e,0x7a, + 0x4f,0x41,0x4b,0x43,0x4c,0x35,0x31,0x32,0x46,0x5a,0x76,0x76,0x34, + 0x56,0x5a,0x78,0x39,0x34,0x54,0x70,0x62,0x41,0x39,0x6c,0x78,0x79, + 0x6f,0x41,0x65,0x6a,0x41,0x43,0x65,0x4f,0x4f,0x31,0x48,0x49,0x62, + 0x41,0x63,0x74,0x41,0x65,0x76,0x0a,0x6b,0x35,0x4d,0x55,0x42,0x68, + 0x4e,0x65,0x4c,0x5a,0x61,0x2f,0x71,0x4d,0x32,0x4a,0x41,0x52,0x55, + 0x44,0x42,0x52,0x41,0x36,0x63,0x47,0x42,0x76,0x64,0x37,0x4c,0x6d, + 0x41,0x44,0x30,0x6c,0x30,0x39,0x6b,0x42,0x41,0x54,0x57,0x6e,0x42, + 0x2f,0x39,0x41,0x6e,0x35,0x76,0x66,0x69,0x55,0x55,0x45,0x31,0x56, + 0x51,0x6e,0x74,0x2b,0x54,0x2f,0x0a,0x45,0x59,0x6b,0x6c,0x45,0x53, + 0x33,0x74,0x58,0x58,0x61,0x4a,0x4a,0x70,0x39,0x70,0x48,0x4d,0x61, + 0x34,0x66,0x7a,0x46,0x61,0x38,0x6a,0x50,0x56,0x74,0x76,0x35,0x55, + 0x42,0x48,0x47,0x65,0x65,0x33,0x58,0x6f,0x55,0x4e,0x44,0x56,0x77, + 0x4d,0x32,0x4f,0x67,0x53,0x45,0x49,0x53,0x5a,0x78,0x62,0x7a,0x64, + 0x58,0x47,0x6e,0x71,0x49,0x6c,0x0a,0x63,0x54,0x30,0x38,0x54,0x7a, + 0x42,0x55,0x44,0x39,0x69,0x35,0x37,0x39,0x75,0x69,0x66,0x6b,0x6c, + 0x4c,0x73,0x6e,0x72,0x33,0x35,0x53,0x4a,0x44,0x5a,0x36,0x72,0x61, + 0x6d,0x35,0x31,0x2f,0x43,0x57,0x4f,0x6e,0x6e,0x61,0x56,0x68,0x55, + 0x7a,0x6e,0x65,0x4f,0x41,0x39,0x67,0x54,0x50,0x53,0x72,0x2b,0x2f, + 0x66,0x54,0x33,0x57,0x65,0x56,0x0a,0x6e,0x77,0x4a,0x69,0x51,0x43, + 0x51,0x33,0x30,0x6b,0x4e,0x4c,0x57,0x56,0x58,0x57,0x41,0x54,0x4d, + 0x6e,0x73,0x6e,0x54,0x34,0x38,0x36,0x65,0x41,0x4f,0x6c,0x54,0x36, + 0x55,0x4e,0x42,0x50,0x59,0x51,0x4c,0x70,0x55,0x70,0x72,0x46,0x35, + 0x59,0x72,0x79,0x6b,0x32,0x33,0x70,0x51,0x55,0x50,0x41,0x67,0x4a, + 0x45,0x4e,0x44,0x45,0x71,0x65,0x0a,0x55,0x36,0x69,0x49,0x4f,0x39, + 0x4f,0x74,0x31,0x5a,0x50,0x74,0x42,0x30,0x6c,0x6e,0x69,0x77,0x2b, + 0x2f,0x78,0x43,0x69,0x31,0x33,0x44,0x33,0x36,0x30,0x6f,0x31,0x74, + 0x5a,0x44,0x59,0x4f,0x70,0x30,0x68,0x48,0x48,0x4a,0x4e,0x33,0x44, + 0x33,0x45,0x4e,0x38,0x43,0x31,0x79,0x50,0x71,0x5a,0x64,0x35,0x43, + 0x76,0x76,0x7a,0x6e,0x59,0x76,0x0a,0x42,0x36,0x62,0x57,0x42,0x49, + 0x70,0x57,0x63,0x52,0x67,0x64,0x6e,0x32,0x44,0x55,0x56,0x4d,0x6d, + 0x70,0x55,0x36,0x36,0x31,0x6a,0x77,0x71,0x47,0x6c,0x52,0x7a,0x31, + 0x46,0x38,0x34,0x4a,0x47,0x2f,0x78,0x65,0x34,0x6a,0x47,0x75,0x7a, + 0x67,0x70,0x4a,0x74,0x39,0x49,0x58,0x53,0x7a,0x79,0x6f,0x68,0x45, + 0x4a,0x42,0x36,0x58,0x47,0x35,0x0a,0x2b,0x44,0x30,0x42,0x75,0x51, + 0x49,0x4e,0x42,0x44,0x6e,0x75,0x39,0x4a,0x49,0x51,0x43,0x41,0x43, + 0x45,0x6b,0x64,0x42,0x4e,0x36,0x4d,0x78,0x66,0x35,0x57,0x76,0x71, + 0x44,0x57,0x6b,0x63,0x4d,0x52,0x79,0x36,0x77,0x6e,0x72,0x64,0x39, + 0x44,0x59,0x4a,0x38,0x55,0x55,0x54,0x6d,0x49,0x54,0x32,0x69,0x51, + 0x66,0x30,0x37,0x74,0x52,0x55,0x0a,0x4b,0x4a,0x4a,0x39,0x76,0x30, + 0x4a,0x58,0x66,0x78,0x32,0x5a,0x34,0x64,0x30,0x38,0x49,0x51,0x53, + 0x4d,0x4e,0x52,0x61,0x71,0x34,0x56,0x67,0x53,0x65,0x2b,0x50,0x64, + 0x59,0x67,0x49,0x79,0x30,0x66,0x62,0x6a,0x32,0x33,0x56,0x69,0x61, + 0x35,0x2f,0x67,0x4f,0x37,0x66,0x4a,0x45,0x70,0x44,0x32,0x68,0x64, + 0x32,0x66,0x2b,0x70,0x4d,0x6e,0x0a,0x4f,0x57,0x76,0x48,0x32,0x72, + 0x4f,0x4f,0x49,0x62,0x65,0x59,0x66,0x75,0x68,0x7a,0x41,0x63,0x36, + 0x42,0x51,0x6a,0x41,0x4b,0x74,0x6d,0x67,0x52,0x30,0x45,0x52,0x55, + 0x54,0x61,0x66,0x54,0x4d,0x39,0x57,0x62,0x36,0x46,0x31,0x33,0x43, + 0x4e,0x5a,0x5a,0x4e,0x5a,0x66,0x44,0x71,0x6e,0x46,0x44,0x50,0x36, + 0x4c,0x31,0x32,0x77,0x33,0x7a,0x0a,0x33,0x46,0x37,0x46,0x46,0x58, + 0x6b,0x7a,0x30,0x37,0x52,0x73,0x33,0x41,0x49,0x74,0x6f,0x31,0x5a, + 0x66,0x59,0x5a,0x64,0x34,0x73,0x43,0x53,0x70,0x4d,0x72,0x2f,0x30, + 0x53,0x35,0x6e,0x4c,0x72,0x48,0x62,0x49,0x76,0x47,0x4c,0x70,0x32, + 0x37,0x31,0x68,0x68,0x51,0x42,0x65,0x52,0x6d,0x6d,0x6f,0x47,0x45, + 0x4b,0x4f,0x32,0x4a,0x52,0x65,0x0a,0x6c,0x47,0x67,0x55,0x4a,0x32, + 0x43,0x55,0x7a,0x4f,0x64,0x74,0x77,0x44,0x49,0x4b,0x54,0x30,0x4c, + 0x62,0x43,0x70,0x76,0x61,0x50,0x38,0x50,0x56,0x6e,0x59,0x46,0x35, + 0x49,0x46,0x6f,0x59,0x4a,0x49,0x57,0x52,0x48,0x71,0x6c,0x45,0x74, + 0x35,0x75,0x63,0x54,0x58,0x73,0x74,0x5a,0x79,0x37,0x76,0x59,0x6a, + 0x4c,0x36,0x76,0x54,0x50,0x34,0x0a,0x6c,0x35,0x78,0x73,0x2b,0x4c, + 0x49,0x4f,0x6b,0x4e,0x6d,0x50,0x68,0x71,0x6d,0x66,0x73,0x67,0x4c, + 0x7a,0x56,0x6f,0x30,0x55,0x61,0x4c,0x74,0x38,0x30,0x68,0x4f,0x77, + 0x63,0x34,0x4e,0x76,0x44,0x43,0x4f,0x4c,0x41,0x41,0x4d,0x47,0x42, + 0x2f,0x39,0x67,0x2b,0x39,0x56,0x33,0x4f,0x52,0x7a,0x77,0x34,0x4c, + 0x76,0x4f,0x31,0x70,0x77,0x52,0x0a,0x59,0x4a,0x71,0x66,0x44,0x4b, + 0x55,0x71,0x2f,0x45,0x4a,0x30,0x72,0x4e,0x4d,0x4d,0x44,0x34,0x4e, + 0x38,0x52,0x4c,0x70,0x5a,0x52,0x68,0x4b,0x48,0x4b,0x4a,0x55,0x6d, + 0x39,0x6e,0x4e,0x48,0x4c,0x62,0x6b,0x73,0x6e,0x6c,0x5a,0x77,0x72, + 0x62,0x53,0x54,0x4d,0x35,0x4c,0x70,0x43,0x2f,0x55,0x36,0x73,0x68, + 0x65,0x4c,0x50,0x2b,0x6c,0x30,0x0a,0x62,0x4c,0x56,0x6f,0x71,0x30, + 0x6c,0x6d,0x73,0x43,0x63,0x55,0x53,0x79,0x68,0x2b,0x6d,0x59,0x36, + 0x50,0x78,0x57,0x69,0x72,0x4c,0x49,0x57,0x43,0x6e,0x2f,0x49,0x41, + 0x5a,0x41,0x47,0x6e,0x58,0x62,0x36,0x5a,0x64,0x36,0x54,0x74,0x49, + 0x4a,0x6c,0x47,0x47,0x36,0x70,0x71,0x55,0x4e,0x38,0x51,0x78,0x47, + 0x4a,0x59,0x51,0x6e,0x6f,0x6e,0x0a,0x6c,0x30,0x75,0x54,0x4a,0x4b, + 0x48,0x4a,0x45,0x4e,0x62,0x49,0x39,0x73,0x57,0x48,0x51,0x64,0x63, + 0x54,0x74,0x42,0x4d,0x63,0x33,0x34,0x67,0x6f,0x72,0x48,0x46,0x43, + 0x6f,0x31,0x42,0x63,0x76,0x70,0x6e,0x63,0x31,0x4c,0x46,0x4c,0x72, + 0x57,0x6e,0x37,0x6d,0x66,0x6f,0x47,0x78,0x36,0x49,0x4e,0x51,0x6a, + 0x66,0x33,0x48,0x47,0x51,0x70,0x0a,0x4d,0x58,0x41,0x57,0x75,0x53, + 0x42,0x51,0x68,0x7a,0x6b,0x61,0x7a,0x59,0x36,0x76,0x61,0x57,0x46, + 0x70,0x61,0x38,0x62,0x42,0x4a,0x2b,0x67,0x4b,0x62,0x42,0x75,0x79, + 0x53,0x57,0x7a,0x4e,0x6d,0x33,0x72,0x46,0x74,0x54,0x35,0x48,0x52, + 0x4b,0x4d,0x57,0x70,0x4f,0x2b,0x4d,0x39,0x62,0x48,0x70,0x34,0x64, + 0x2b,0x70,0x75,0x59,0x30,0x4c,0x0a,0x31,0x59,0x77,0x4e,0x31,0x4f, + 0x4d,0x61,0x74,0x63,0x4d,0x4d,0x70,0x63,0x57,0x6e,0x5a,0x70,0x69, + 0x57,0x69,0x52,0x38,0x33,0x6f,0x69,0x33,0x32,0x2b,0x78,0x74,0x57, + 0x55,0x59,0x32,0x55,0x37,0x41,0x65,0x33,0x38,0x6d,0x4d,0x61,0x67, + 0x38,0x7a,0x46,0x62,0x70,0x65,0x71,0x50,0x51,0x55,0x73,0x44,0x76, + 0x39,0x56,0x37,0x43,0x41,0x4a,0x0a,0x31,0x64,0x62,0x72,0x69,0x45, + 0x77,0x45,0x47,0x42,0x45,0x43,0x41,0x41,0x77,0x46,0x41,0x6b,0x44, + 0x59,0x42,0x6e,0x6f,0x46,0x43,0x51,0x35,0x74,0x33,0x2b,0x67,0x41, + 0x43,0x67,0x6b,0x51,0x71,0x45,0x37,0x61,0x36,0x4a,0x79,0x41,0x43, + 0x73,0x70,0x6e,0x70,0x67,0x43,0x66,0x52,0x62,0x59,0x77,0x78,0x54, + 0x33,0x69,0x71,0x2b,0x39,0x6c,0x0a,0x2f,0x50,0x67,0x4e,0x54,0x55, + 0x4e,0x54,0x5a,0x4f,0x6c,0x6f,0x66,0x32,0x6f,0x41,0x6e,0x32,0x35, + 0x79,0x30,0x65,0x47,0x69,0x30,0x33,0x37,0x31,0x6a,0x61,0x70,0x39, + 0x6b,0x4f,0x56,0x36,0x75,0x71,0x37,0x31,0x73,0x55,0x75,0x4f,0x0a, + 0x3d,0x70,0x4a,0x6c,0x69,0x0a,0x2d,0x2d,0x2d,0x2d,0x2d,0x45,0x4e, + 0x44,0x20,0x50,0x47,0x50,0x20,0x50,0x55,0x42,0x4c,0x49,0x43,0x20, + 0x4b,0x45,0x59,0x20,0x42,0x4c,0x4f,0x43,0x4b,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x0a,0x00, +}; + +size_t _susekey_size=2173; +size_t *susekey_size=&_susekey_size; void publickey_test() { BOOST_CHECK_THROW( zypp::devel::PublicKey("nonexistant"), Exception ); - zypp::devel::PublicKey k1("publickey-1.asc"); - - BOOST_CHECK_EQUAL( k1.id(), "CD1EB6A9667E42D1"); - BOOST_CHECK_EQUAL( k1.name(), "Duncan Mac-Vicar Prett " ); - BOOST_CHECK_EQUAL( k1.fingerprint(), "75DA7B971FD6ADB9A880BA9FCD1EB6A9667E42D1" ); - - zypp::devel::PublicKey k2("publickey-suse.asc"); + filesystem::TmpFile file; + ofstream str(file.path().asString().c_str(),ofstream::out); + + if (!str.good()) + ZYPP_THROW(Exception("cant open file")); + + str << susekey; + str.flush(); + str.close(); + + zypp::devel::PublicKey k2(file.path()); BOOST_CHECK_EQUAL( k2.id(), "A84EDAE89C800ACA" ); BOOST_CHECK_EQUAL( k2.name(), "SuSE Package Signing Key " ); @@ -49,7 +258,7 @@ void publickey_test() } test_suite* -init_unit_test_suite( int, char* [] ) +init_unit_test_suite( int argc, char* argv[] ) { test_suite* test= BOOST_TEST_SUITE( "PublicKeyTest" ); test->add( BOOST_TEST_CASE( &publickey_test ), 0 /* expected zero error */ ); diff --git a/testsuite/zypp/tests/Signature.cc b/testsuite/zypp/tests/Signature.cc new file mode 100644 index 0000000..8bc7518 --- /dev/null +++ b/testsuite/zypp/tests/Signature.cc @@ -0,0 +1,30 @@ + +#include +#include +#include + +#include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" +#include "zypp/Signature.h" + +#include + +using boost::unit_test::test_suite; +using boost::unit_test::test_case; + +using namespace std; +using namespace zypp; + + +void signature_test() +{ +} + +test_suite* +init_unit_test_suite( int, char* [] ) +{ + test_suite* test= BOOST_TEST_SUITE( "SignaureTest" ); + test->add( BOOST_TEST_CASE( &signature_test ), 0 /* expected zero error */ ); + return test; +} + diff --git a/testsuite/zypp/tests/publickey-1.asc b/testsuite/zypp/tests/publickey-1.asc deleted file mode 100644 index df8654e..0000000 --- a/testsuite/zypp/tests/publickey-1.asc +++ /dev/null @@ -1,24 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.2 (GNU/Linux) - -mQGiBDsj/RYRBACQD/DCxkMgmEjBNYh53AfsV+zcMaz4nDmeEElANfHrVzVGx33N -Siiqs33RIjV35Gd8OH1iSnbA7ef0gWELgVSToK2ydv/3X5Cbcb1MOWYQKJE1dQz7 -fw7Ic9nP7NieM18YMsOYEmCvyL4sLZviQIlb3caP+OpI/GAoNINY8m9yowCgxgx1 -L+jnJznXyKy7v5WgwMyrE2cD/38Nvp62Rq1/IqhUDc3SDUp5+xPddwOZ/E7P9F73 -0Gb2ec2fhAm9QZyVvFvLa+SJq2/LvY+vITZSRI0HTBZf4Yrzd6eHu/cDp0m0o/BS -McuoaHmKeHYcyIa2w8LMREpchgdlY/LnHR83Yipc3iegBRUvoTtwUYMqpswwi+6i -50nhA/9MC5cPOZbPpqbaDbSz0NtAVM2gcvgiBx4VKCh/AhkZ+abzogeHn6uT2eaP -3Fnk4YOa0FEbO+YHg3Lu45tZV3pBQUZoY07r5niT0Sb6dAKO/j/omEt4q44OO3ba -fanEvFurtgpkszoD20yheQLhv7CVdS8IUfQ2R+r0eQjxtAfJWLQmRHVuY2FuIE1h -Yy1WaWNhciBQcmV0dCA8ZHVuY2FuQHB1Yy5jbD6IVwQTEQIAFwUCOyP9FgULBwoD -BAMVAwIDFgIBAheAAAoJEM0etqlmfkLRqZUAnA8SIsD1eQkhDR7GkekdXWtlbW1W -AJ0eAtcylAOTGf3AezgtP/vlWtLj5rkBDQQ7I/0vEAQAnZXsJoF43AMGs5ccBsfe -nbLa1GacjBA212+wJ/toRCbs9xzs5dozh+TnY4Px4cQSafdcsmm3jwMVeCdPdRZ0 -RuJ5qEm2e29qm9nj2MTLVMKEjbTS/FbK5SkxKuLUXHsgZyFLGssFjTWDKsX/jy8c -u0Kby++b6gPkO3Ft0BjwyRMAAwUEAJSn61N7TqyPOs5GSCxzUIAbsh4PlGeDZ3Uc -g+CY/+WZS7CzJlUZiDWqIFADmip5FcuF/MV0mYgcd8nMBVcy17maEf1OnfPhEhOj -spu8xBnSNBGWQHQx9h5CBy66riBSHG8czF9/IlKmWgyo+TGJXrxz1R2VIYgoato6 -BKZSduFZiEYEGBECAAYFAjsj/S8ACgkQzR62qWZ+QtFuBQCeMY2aH7t6yvVR6o1W -YopKmcxZw0UAn3iLjS38pR3qIfRN4Qhzktzu1ofB -=G/Ys ------END PGP PUBLIC KEY BLOCK----- diff --git a/testsuite/zypp/tests/publickey-suse.asc b/testsuite/zypp/tests/publickey-suse.asc deleted file mode 100644 index b49e52d..0000000 --- a/testsuite/zypp/tests/publickey-suse.asc +++ /dev/null @@ -1,37 +0,0 @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a/testsuite/zypp/zypp.test/Capabilities.exp b/testsuite/zypp/zypp.test/Capabilities.exp new file mode 100644 index 0000000..74383c0 --- /dev/null +++ b/testsuite/zypp/zypp.test/Capabilities.exp @@ -0,0 +1,4 @@ +# Arch.exp +# run tests for Arch + +shouldPass "Capabilities" diff --git a/testsuite/zypp/zypp.test/CheckSum.exp b/testsuite/zypp/zypp.test/CheckSum.exp new file mode 100644 index 0000000..38cc70a --- /dev/null +++ b/testsuite/zypp/zypp.test/CheckSum.exp @@ -0,0 +1 @@ +shouldPass "CheckSum" diff --git a/testsuite/zypp/zypp.test/PathInfo.exp b/testsuite/zypp/zypp.test/PathInfo.exp new file mode 100644 index 0000000..7d82937 --- /dev/null +++ b/testsuite/zypp/zypp.test/PathInfo.exp @@ -0,0 +1 @@ +shouldPass "PathInfo" diff --git a/testsuite/zypp/zypp.test/Signature.exp b/testsuite/zypp/zypp.test/Signature.exp new file mode 100644 index 0000000..4d02368 --- /dev/null +++ b/testsuite/zypp/zypp.test/Signature.exp @@ -0,0 +1,2 @@ +shouldPass "Signature" + diff --git a/zypp/Makefile.am b/zypp/Makefile.am index b2c38cf..3af75ff 100644 --- a/zypp/Makefile.am +++ b/zypp/Makefile.am @@ -88,6 +88,7 @@ pkginclude_HEADERS = NeedAType.h \ ZYppCallbacks.h \ SilentCallbacks.h \ PublicKey.h \ + Signature.h \ KeyRing.h \ MediaSetAccess.h @@ -164,6 +165,7 @@ lib@PACKAGE@_la_SOURCES = \ TranslatedText.cc \ ZYppFactory.cc \ PublicKey.cc \ + Signature.cc \ KeyRing.cc \ MediaSetAccess.cc diff --git a/zypp/MediaSetAccess.cc b/zypp/MediaSetAccess.cc index fb753f6..f735e6a 100644 --- a/zypp/MediaSetAccess.cc +++ b/zypp/MediaSetAccess.cc @@ -13,6 +13,7 @@ #include "zypp/base/LogTools.h" #include "zypp/ZYppCallbacks.h" #include "zypp/MediaSetAccess.h" +#include "zypp/PathInfo.h" //#include "zypp/source/MediaSetAccessReportReceivers.h" using std::endl; @@ -22,6 +23,16 @@ namespace zypp { ///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// + ChecksumFileChecker::ChecksumFileChecker( const CheckSum &checksum ) + { + + } + + bool ChecksumFileChecker::operator()( const Pathname &file ) + { + + } + MediaSetAccess::MediaSetAccess( const Url &url, const Pathname &path ) : _url(url), _path(path) diff --git a/zypp/MediaSetAccess.h b/zypp/MediaSetAccess.h index 2d01d68..5be6b92 100644 --- a/zypp/MediaSetAccess.h +++ b/zypp/MediaSetAccess.h @@ -65,10 +65,10 @@ namespace zypp class ChecksumFileChecker { public: - ChecksumFileChecker( const CheckSum &checksum ) - {} - bool operator()( const Pathname &file) - { return true; } + ChecksumFileChecker( const CheckSum &checksum ); + bool operator()( const Pathname &file ); + private: + CheckSum _checksum; }; /////////////////////////////////////////////////////////////////// diff --git a/zypp/Signature.cc b/zypp/Signature.cc new file mode 100644 index 0000000..f5d1a11 --- /dev/null +++ b/zypp/Signature.cc @@ -0,0 +1,30 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ + +#include +#include +#include "zypp/Signature.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + Signature::Signature() + { + + } + + std::ostream & Signature::dumpOn( std::ostream & str ) const + { + return str; + } + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/Signature.h b/zypp/Signature.h new file mode 100644 index 0000000..a3d00fb --- /dev/null +++ b/zypp/Signature.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ + + +#ifndef ZYPP_Signature_H +#define ZYPP_Signature_H + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + class Signature + { + public: + Signature(); + ~Signature(); + + /** Overload to realize stream output. */ + std::ostream & dumpOn( std::ostream & str ) const; + + private: + }; + + /** \relates Signature Stream output */ + inline std::ostream & operator<<( std::ostream & str, const Signature & obj ) + { return obj.dumpOn( str ); } + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_Signature_H -- 2.7.4