summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2018-07-17 16:13:09 (GMT)
committerKevin Smith <git@kismith.co.uk>2018-07-17 16:13:14 (GMT)
commit709d35a0e3624046ba00429d50dfd33d8bbc9d9c (patch)
tree7362a929d80dda0725f25beeb3fc6f8fb6ec765b /Swift/Controllers
parentcdd33515142958017563d83b756df0ca31b023a7 (diff)
downloadswift-709d35a0e3624046ba00429d50dfd33d8bbc9d9c.zip
swift-709d35a0e3624046ba00429d50dfd33d8bbc9d9c.tar.bz2
Add unit test for missing bookmark responses
Test-Information: Without the recent fix for missing bookmark results, tests crash, on master they pass Change-Id: Iab2d55d6d60e5926485d31f4dd63a117a9d12aee
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index 7469d64..954dd2f 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -177,6 +177,9 @@ class ChatsManagerTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testAutoJoinBookmarksAndChattables);
CPPUNIT_TEST(testJoinNoAutojoinBookmark);
CPPUNIT_TEST(testJoinAndBookmarkMUC);
+ CPPUNIT_TEST(testReceivingNoBookmarks);
+ CPPUNIT_TEST(testReceivingNullBookmarks);
+ CPPUNIT_TEST(testReceivingBookmarksError);
CPPUNIT_TEST_SUITE_END();
@@ -1691,6 +1694,41 @@ public:
stanzaChannel_->onIQReceived(response);
}
+ void testReceivingNoBookmarks() {
+ auto bookmarkRequest = std::dynamic_pointer_cast<IQ>(stanzaChannel_->sentStanzas[0]);
+ auto response = IQ::createResult(
+ bookmarkRequest->getFrom(),
+ bookmarkRequest->getTo(),
+ bookmarkRequest->getID(),
+ std::make_shared<PrivateStorage>()
+ );
+ stanzaChannel_->onIQReceived(response);
+ }
+
+ void testReceivingNullBookmarks() {
+ auto bookmarkRequest = std::dynamic_pointer_cast<IQ>(stanzaChannel_->sentStanzas[0]);
+ auto response = IQ::createResult(
+ bookmarkRequest->getFrom(),
+ bookmarkRequest->getTo(),
+ bookmarkRequest->getID(),
+ nullptr
+ );
+ stanzaChannel_->onIQReceived(response);
+ }
+
+ void testReceivingBookmarksError() {
+ auto bookmarkRequest = std::dynamic_pointer_cast<IQ>(stanzaChannel_->sentStanzas[0]);
+ auto response = IQ::createError(
+ bookmarkRequest->getFrom(),
+ bookmarkRequest->getTo(),
+ bookmarkRequest->getID(),
+ ErrorPayload::Condition::ServiceUnavailable,
+ ErrorPayload::Type::Cancel,
+ nullptr
+ );
+ stanzaChannel_->onIQReceived(response);
+ }
+
void testReceivingBookmarksWithFullJID() {
auto bookmarkRequest = std::dynamic_pointer_cast<IQ>(stanzaChannel_->sentStanzas[0]);
auto response = IQ::createResult(