--- /dev/null
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <streambuf>
+
+#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp
+#include "boost/filesystem/fstream.hpp" // ditto
+
+#include <boost/iostreams/device/file_descriptor.hpp>
+
+#include <zypp/base/Logger.h>
+#include <zypp/Locale.h>
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+#include <zypp/TranslatedText.h>
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/parser/yum/YUMParser.h>
+#include <zypp/base/Logger.h>
+#include <zypp/NVRAD.h>
+#include <zypp/target/rpm/RpmDb.h>
+#include <zypp/source/yum/YUMScriptImpl.h>
+#include <zypp/source/yum/YUMMessageImpl.h>
+#include <zypp/source/yum/YUMPackageImpl.h>
+#include <zypp/source/yum/YUMSourceImpl.h>
+
+#include <map>
+#include <set>
+
+#include <zypp/CapFactory.h>
+#include <zypp/KeyRing.h>
+#include <zypp/PublicKey.h>
+
+using namespace zypp::detail;
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::parser::yum;
+using namespace zypp::source::yum;
+
+
+
+//using namespace DbXml;
+
+int main()
+{
+ zypp::devel::PublicKey k("/suse/dmacvicar/duncan.txt");
+
+ cout << k.id() << std::endl;
+ cout << k.fingerprint() << std::endl;
+ cout << k.name() << std::endl;
+
+}
+
+
#include "zypp/PublicKey.h"
#include "zypp/ZYppFactory.h"
#include "zypp/ZYpp.h"
-#include "testsuite/src/utils/TestUtils.h"
+
+#include <boost/test/unit_test.hpp>
+
+using boost::unit_test::test_suite;
+using boost::unit_test::test_case;
using namespace std;
using namespace zypp;
-using namespace zypp::testsuite::utils;
-int main( int argc, char * argv[] )
+void publickey_test()
{
- try
- {
- zypp::devel::PublicKey k1("publickey-1.asc");
+ BOOST_CHECK_THROW( zypp::devel::PublicKey("nonexistant"), Exception );
- assert_equal( k1.id(), "CD1EB6A9667E42D1");
- assert_equal( k1.name(), "Duncan Mac-Vicar Prett <duncan@puc.cl>" );
- assert_equal( k1.fingerprint(), "75DA7B971FD6ADB9A880BA9FCD1EB6A9667E42D1" );
+ zypp::devel::PublicKey k1("publickey-1.asc");
- zypp::devel::PublicKey k2("publickey-suse.asc");
+ BOOST_CHECK_EQUAL( k1.id(), "CD1EB6A9667E42D1");
+ BOOST_CHECK_EQUAL( k1.name(), "Duncan Mac-Vicar Prett <duncan@puc.cl>" );
+ BOOST_CHECK_EQUAL( k1.fingerprint(), "75DA7B971FD6ADB9A880BA9FCD1EB6A9667E42D1" );
- assert_equal( k2.id(), "A84EDAE89C800ACA" );
- assert_equal( k2.name(), "SuSE Package Signing Key <build@suse.de>" );
- assert_equal( k2.fingerprint(), "79C179B2E1C820C1890F9994A84EDAE89C800ACA" );
-
- return 0;
- }
- catch(const Exception &e)
- {
- return 40;
- }
+ zypp::devel::PublicKey k2("publickey-suse.asc");
- return 0;
+ BOOST_CHECK_EQUAL( k2.id(), "A84EDAE89C800ACA" );
+ BOOST_CHECK_EQUAL( k2.name(), "SuSE Package Signing Key <build@suse.de>" );
+ BOOST_CHECK_EQUAL( k2.fingerprint(), "79C179B2E1C820C1890F9994A84EDAE89C800ACA" );
+
}
+
+test_suite*
+init_unit_test_suite( int, char* [] )
+{
+ test_suite* test= BOOST_TEST_SUITE( "PublicKeyTest" );
+ test->add( BOOST_TEST_CASE( &publickey_test ), 0 /* expected zero error */ );
+ return test;
+}
+