Parcourir la source

[1975] Test reconfiguration

We try calling the configure function multiple times on the same object.
Michal 'vorner' Vaner il y a 13 ans
Parent
commit
f661e074e4
1 fichiers modifiés avec 11 ajouts et 0 suppressions
  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("["