diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-06-11 20:22:04 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-06-11 20:25:09 (GMT) |
commit | aa32913718442aecb7b22e891bd6f1a1ceca9d8c (patch) | |
tree | 297ff941043aa63da0bad5d1094220f093253b4d /Swiften/Queries/UnitTest | |
parent | a17bb9f842aca9ad9b414237ad576aa7a887349e (diff) | |
download | swift-aa32913718442aecb7b22e891bd6f1a1ceca9d8c.zip swift-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.cpp | 11 |
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) { |