Browse Source

[1177] Tests for names before origin

Michal 'vorner' Vaner 13 years ago
parent
commit
b8e90124c1

+ 7 - 0
src/lib/datasrc/tests/database_unittest.cc

@@ -2353,6 +2353,13 @@ TYPED_TEST(DatabaseClientTest, previous) {
 
         EXPECT_THROW(finder->findPreviousName(Name("bad.example.org")),
                      isc::NotImplemented);
+    } else {
+        // No need to test this on mock one, because we test only that
+        // the exception gets through
+
+        // A name before the origin
+        EXPECT_THROW(finder->findPreviousName(Name("example.com")),
+                     isc::NotImplemented);
     }
 }
 

+ 5 - 0
src/lib/datasrc/tests/sqlite3_accessor_unittest.cc

@@ -375,6 +375,11 @@ TEST_F(SQLite3AccessorTest, findPrevious) {
     // be skipped.
     EXPECT_EQ("example.com.",
               accessor->findPreviousName(1, "com.example.cname-ext."));
+    // Throw when we are before the origin
+    EXPECT_THROW(accessor->findPreviousName(1, "com.example."),
+                 isc::NotImplemented);
+    EXPECT_THROW(accessor->findPreviousName(1, "a.example."),
+                 isc::NotImplemented);
 }
 
 TEST_F(SQLite3AccessorTest, findPreviousNoData) {