Browse Source

[1577] Test findNSEC3 throws on non-NSEC3 zone

Just confirming it throws in case there's no NSEC3PARAM to compute the
hash by.
Michal 'vorner' Vaner 13 years ago
parent
commit
b407617f16
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/lib/datasrc/tests/database_unittest.cc

+ 6 - 2
src/lib/datasrc/tests/database_unittest.cc

@@ -3575,8 +3575,6 @@ TEST_F(MockDatabaseClientTest, journalWithBadData) {
 TEST_F(MockDatabaseClientTest, findNSEC3) {
     // Set up the faked hash calculator.
     setNSEC3HashCreator(&test_nsec3_hash_creator_);
-    // And enable NSEC3 in the zone.
-    this->current_accessor_->enableNSEC3();
 
     DataSourceClient::FindResult
         zone(this->client_->findZone(Name("example.org")));
@@ -3584,6 +3582,12 @@ TEST_F(MockDatabaseClientTest, findNSEC3) {
     boost::shared_ptr<DatabaseClient::Finder> finder(
         dynamic_pointer_cast<DatabaseClient::Finder>(zone.zone_finder));
 
+    // It'll complain if there is no NSEC3PARAM yet
+    EXPECT_THROW(finder->findNSEC3(Name("example.org"), false),
+                 DataSourceError);
+    // And enable NSEC3 in the zone.
+    this->current_accessor_->enableNSEC3();
+
     // Parameter validation: the query name must be in or below the zone
     EXPECT_THROW(finder->findNSEC3(Name("example.com"), false), OutOfZone);
     EXPECT_THROW(finder->findNSEC3(Name("org"), true), OutOfZone);