summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSonny Piers <sonny@fastmail.net>2016-04-08 13:06:32 +0200
committerSonny Piers <sonny@fastmail.net>2016-04-08 18:09:50 +0200
commitd3f16a5711f6d4131c13f548efd3d22d9fac7952 (patch)
treea82039925cff57493e2ac873b0bcb0c2550c0d3d /test
parent9c04cb29957002b7ecef20feed93726b386b8a21 (diff)
system.listNotifications RPC method
Diffstat (limited to 'test')
-rw-r--r--test/RpcMethodTest.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/RpcMethodTest.cc b/test/RpcMethodTest.cc
index 1bcac3af..f89afd9b 100644
--- a/test/RpcMethodTest.cc
+++ b/test/RpcMethodTest.cc
@@ -80,6 +80,7 @@ class RpcMethodTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testSystemMulticall);
CPPUNIT_TEST(testSystemMulticall_fail);
CPPUNIT_TEST(testSystemListMethods);
+ CPPUNIT_TEST(testSystemListNotifications);
CPPUNIT_TEST_SUITE_END();
private:
@@ -146,6 +147,7 @@ public:
void testSystemMulticall();
void testSystemMulticall_fail();
void testSystemListMethods();
+ void testSystemListNotifications();
};
CPPUNIT_TEST_SUITE_REGISTRATION(RpcMethodTest);
@@ -1396,6 +1398,24 @@ void RpcMethodTest::testSystemListMethods()
}
}
+void RpcMethodTest::testSystemListNotifications()
+{
+ SystemListNotificationsRpcMethod m;
+ auto res = m.execute(createReq("system.listNotifications"), e_.get());
+ CPPUNIT_ASSERT_EQUAL(0, res.code);
+
+ const auto resParams = downcast<List>(res.param);
+ auto& allNames = allNotificationsNames();
+
+ CPPUNIT_ASSERT_EQUAL(allNames.size(), resParams->size());
+
+ for (size_t i = 0; i < allNames.size(); ++i) {
+ const auto s = downcast<String>(resParams->get(i));
+ CPPUNIT_ASSERT(s);
+ CPPUNIT_ASSERT_EQUAL(allNames[i], s->s());
+ }
+}
+
} // namespace rpc
} // namespace aria2