diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/certs_.cpp | 5 | ||||
-rw-r--r-- | tests/certs_.h | 1 | ||||
-rw-r--r-- | tests/stubs_.cpp | 19 | ||||
-rw-r--r-- | tests/test_db.cpp | 64 |
4 files changed, 2 insertions, 87 deletions
diff --git a/tests/certs_.cpp b/tests/certs_.cpp index 8155b90..b63c48b 100644 --- a/tests/certs_.cpp +++ b/tests/certs_.cpp @@ -31,8 +31,3 @@ Certs_::ocsp_response_t Certs_::check_ocsp_chain_ (const chain_t &chain) { return this->check_ocsp_chain(chain); } - -void Certs_::find_app_signatures_ (app_t &app, const std::string &app_path, ocsp_urls_t &ocsp_urls) -{ - return this->find_app_signatures(app, app_path, ocsp_urls); -} diff --git a/tests/certs_.h b/tests/certs_.h index 70dece5..ba1daab 100644 --- a/tests/certs_.h +++ b/tests/certs_.h @@ -31,7 +31,6 @@ class Certs_ : public Certs { public: virtual ~Certs_(); ocsp_response_t check_ocsp_chain_ (const chain_t &chain); - void find_app_signatures_ (app_t &app, const std::string &app_path, ocsp_urls_t &ocsp_urls); }; #endif //CCHECKER_DBFIXTURE_H diff --git a/tests/stubs_.cpp b/tests/stubs_.cpp index 9eb8cfa..c63c668 100644 --- a/tests/stubs_.cpp +++ b/tests/stubs_.cpp @@ -35,14 +35,13 @@ Certs::Certs() Certs::~Certs() {} -void Certs::get_certificates (app_t &app, ocsp_urls_t &ocsp_urls) +void Certs::get_certificates(app_t &app) { (void)app; - (void)ocsp_urls; } // Only the public functions need to be stubbed for testing all possibilities -Certs::ocsp_response_t Certs::check_ocsp (const app_t &app) +Certs::ocsp_response_t Certs::check_ocsp(const app_t &app) { if (app.signatures.empty()) return ocsp_response_t::OCSP_APP_OK; @@ -74,20 +73,6 @@ DB::SqlQuery::SqlQuery(const std::string &path) DB::SqlQuery::~SqlQuery() {} -bool DB::SqlQuery::get_url(const std::string &issuer, std::string &url) -{ - (void)issuer; - (void)url; - return false; -} - -void DB::SqlQuery::set_url(const std::string &issuer, const std::string &url, const int64_t &date) -{ - (void)issuer; - (void)url; - (void)date; -} - bool DB::SqlQuery::add_app_to_check_list(const app_t &app) { (void)app; diff --git a/tests/test_db.cpp b/tests/test_db.cpp index 95267e5..31e7bf6 100644 --- a/tests/test_db.cpp +++ b/tests/test_db.cpp @@ -30,70 +30,6 @@ BOOST_FIXTURE_TEST_SUITE(DB_TEST, DBFixture) -BOOST_AUTO_TEST_CASE(DB_url) { - std::string url; - std::string url_org = "url://url"; - std::string url_update = "http://issuer"; - std::string url_org2 = "address"; - std::string url_update2 = "random_text"; - std::string url_org3 = "########"; - std::string url_update3 = "@@@"; - - // No url in database - BOOST_REQUIRE(get_url("Issuer_test1", url)==false); - BOOST_REQUIRE(get_url("Issuer_test2", url)==false); - BOOST_REQUIRE(get_url("Issuer_test3", url)==false); - - // Url should be added - set_url("Issuer_test1", url_org, 500); - BOOST_REQUIRE(get_url("Issuer_test1", url)==true); - BOOST_REQUIRE(url==url_org); - - // Url for issuer 2 and 3 should remain empty - BOOST_REQUIRE(get_url("Issuer_test2", url)==false); - BOOST_REQUIRE(get_url("Issuer_test3", url)==false); - - // Should NOT be updated. Should get original url. - set_url("Issuer_test1", url_update, 400); - BOOST_REQUIRE(get_url("Issuer_test1", url)==true); - BOOST_REQUIRE(url==url_org); - - // Should be updated. Should get updated url. - set_url("Issuer_test1", url_update, 600); - BOOST_REQUIRE(get_url("Issuer_test1", url)==true); - BOOST_REQUIRE(url==url_update); - - // Add url for new issuer - set_url("Issuer_test2", url_org2, 200); - BOOST_REQUIRE(get_url("Issuer_test2", url)==true); - BOOST_REQUIRE(url==url_org2); - - // Url for issuer 3 should remain empty - BOOST_REQUIRE(get_url("Issuer_test3", url)==false); - - // Add url for issuer 3 - set_url("Issuer_test3", url_org3, 1000); - BOOST_REQUIRE(get_url("Issuer_test3", url)==true); - BOOST_REQUIRE(url==url_org3); - - // Urls for issuer 1 and 2 should remain as they were - BOOST_REQUIRE(get_url("Issuer_test1", url)==true); - BOOST_REQUIRE(url==url_update); - BOOST_REQUIRE(get_url("Issuer_test2", url)==true); - BOOST_REQUIRE(url==url_org2); - - // Update url for issuer 3 - set_url("Issuer_test3", url_update3, 1001); - BOOST_REQUIRE(get_url("Issuer_test3", url)==true); - BOOST_REQUIRE(url==url_update3); - - // Urls for issuer 1 and 2 should remain as they were - BOOST_REQUIRE(get_url("Issuer_test1", url)==true); - BOOST_REQUIRE(url==url_update); - BOOST_REQUIRE(get_url("Issuer_test2", url)==true); - BOOST_REQUIRE(url==url_org2); -} - BOOST_AUTO_TEST_CASE(DB_app_positive) { std::list<app_t> buffer; |