summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-06-11 20:22:04 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-06-11 20:25:09 (GMT)
commitaa32913718442aecb7b22e891bd6f1a1ceca9d8c (patch)
tree297ff941043aa63da0bad5d1094220f093253b4d /Swiften/Queries/UnitTest
parenta17bb9f842aca9ad9b414237ad576aa7a887349e (diff)
downloadswift-contrib-aa32913718442aecb7b22e891bd6f1a1ceca9d8c.zip
swift-contrib-aa32913718442aecb7b22e891bd6f1a1ceca9d8c.tar.bz2
Do not allow a request response before it is sent.
Diffstat (limited to 'Swiften/Queries/UnitTest')
-rw-r--r--Swiften/Queries/UnitTest/RequestTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Swiften/Queries/UnitTest/RequestTest.cpp b/Swiften/Queries/UnitTest/RequestTest.cpp
index 31c0603..ea6dee6 100644
--- a/Swiften/Queries/UnitTest/RequestTest.cpp
+++ b/Swiften/Queries/UnitTest/RequestTest.cpp
@@ -18,6 +18,7 @@ class RequestTest : public CppUnit::TestFixture
CPPUNIT_TEST(testHandleIQ);
CPPUNIT_TEST(testHandleIQ_InvalidID);
CPPUNIT_TEST(testHandleIQ_Error);
+ CPPUNIT_TEST(testHandleIQ_BeforeSend);
CPPUNIT_TEST_SUITE_END();
public:
@@ -100,6 +101,16 @@ class RequestTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(1, errorsReceived_);
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
}
+
+ void testHandleIQ_BeforeSend() {
+ MyRequest testling(IQ::Get, JID("foo@bar.com/baz"), payload_, router_);
+ testling.onResponse.connect(boost::bind(&RequestTest::handleResponse, this, _1, _2));
+ channel_->onIQReceived(createResponse("test-id"));
+
+ CPPUNIT_ASSERT_EQUAL(0, responsesReceived_);
+ CPPUNIT_ASSERT_EQUAL(0, errorsReceived_);
+ CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(channel_->iqs_.size()));
+ }
private:
void handleResponse(boost::shared_ptr<Payload> p, const boost::optional<Error>& e) {