Browse Source

[1914] Fix tests

The fake session didn't want to support hasQueuedMessages properly.
Also, we need to be subscribed to the correct group to actually get the
messages through the session.
Michal 'vorner' Vaner 13 years ago
parent
commit
a2be2f5cfe

+ 6 - 1
src/lib/config/tests/ccsession_unittests.cc

@@ -722,7 +722,12 @@ protected:
     AsyncReceiveCCSessionTest() :
     AsyncReceiveCCSessionTest() :
         mccs_(ccspecfile("spec29.spec"), session, NULL, NULL, false, false),
         mccs_(ccspecfile("spec29.spec"), session, NULL, NULL, false, false),
         next_flag_(0)
         next_flag_(0)
-    {}
+    {
+        // This is just to make sure the messages get through the fake
+        // session.
+        session.subscribe("test group");
+        session.subscribe("<ignored>");
+    }
     /// \brief Convenience function to queue a request to get a command
     /// \brief Convenience function to queue a request to get a command
     ///     message.
     ///     message.
     ModuleCCSession::AsyncRecvRequestID
     ModuleCCSession::AsyncRecvRequestID

+ 1 - 1
src/lib/config/tests/fake_session.cc

@@ -207,7 +207,7 @@ FakeSession::reply(ConstElementPtr envelope, ConstElementPtr newmsg) {
 
 
 bool
 bool
 FakeSession::hasQueuedMsgs() const {
 FakeSession::hasQueuedMsgs() const {
-    return (false);
+    return (messages_ && messages_->size() > 0);
 }
 }
 
 
 ConstElementPtr
 ConstElementPtr