Browse Source

[1975] Test reconfiguration

We try calling the configure function multiple times on the same object.
Michal 'vorner' Vaner 13 years ago
parent
commit
f661e074e4
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/lib/datasrc/tests/container_unittest.cc

+ 11 - 0
src/lib/datasrc/tests/container_unittest.cc

@@ -438,6 +438,17 @@ TEST_F(ContainerTest, defaults) {
     checkDS(0, "type1", "null");
 }
 
+// Check we can call the configure multiple times, to change the configuration
+TEST_F(ContainerTest, reconfigure) {
+    ConstElementPtr empty(new ListElement);
+    container_->configure(config_elem_, true);
+    checkDS(0, "test_type", "{}");
+    container_->configure(empty, true);
+    EXPECT_TRUE(container_->dataSources().empty());
+    container_->configure(config_elem_, true);
+    checkDS(0, "test_type", "{}");
+}
+
 // Make sure the data source error exception from the factory is propagated
 TEST_F(ContainerTest, dataSrcError) {
     ConstElementPtr elem(Element::fromJSON("["