core: change ManagerBase::authorize to makeAuthorization
refs #2063
Change-Id: I0e6faced6e4e1733362e3ec018e2ee60fcefafa1
diff --git a/tests/core/manager-base.t.cpp b/tests/core/manager-base.t.cpp
index 7ebe95e..6e696ff 100644
--- a/tests/core/manager-base.t.cpp
+++ b/tests/core/manager-base.t.cpp
@@ -56,15 +56,19 @@
public:
ManagerTester(Dispatcher& dispatcher,
const std::string& module)
- : ManagerBase(dispatcher, module) {
+ : ManagerBase(dispatcher, module)
+ {
}
- virtual void
- authorize(const Name& prefix, const Interest& interest,
- const ndn::mgmt::ControlParameters* params,
- ndn::mgmt::AcceptContinuation accept,
- ndn::mgmt::RejectContinuation reject) {
- extractRequester(interest, accept);
+ virtual ndn::mgmt::Authorization
+ makeAuthorization(const std::string& verb) override
+ {
+ return [this] (const Name& prefix, const Interest& interest,
+ const ndn::mgmt::ControlParameters* params,
+ ndn::mgmt::AcceptContinuation accept,
+ ndn::mgmt::RejectContinuation reject) {
+ accept("requester");
+ };
}
};
diff --git a/tests/daemon/mgmt/nfd-manager-base.t.cpp b/tests/daemon/mgmt/nfd-manager-base.t.cpp
index 410f41c..340c9ec 100644
--- a/tests/daemon/mgmt/nfd-manager-base.t.cpp
+++ b/tests/daemon/mgmt/nfd-manager-base.t.cpp
@@ -57,6 +57,8 @@
BOOST_AUTO_TEST_CASE(CommandAuthorization)
{
+ ndn::mgmt::Authorization authorize = m_manager.makeAuthorization("test-verb");
+
bool didAcceptCallbackFire = false;
bool didRejectCallbackFire = false;
auto testAuthorization = [&] {
@@ -66,9 +68,9 @@
auto command = makeControlCommandRequest("/localhost/nfd/test-module/test-verb",
ControlParameters());
ndn::nfd::ControlParameters params;
- m_manager.authorize("/top/prefix", *command, ¶ms,
- bind([&] { didAcceptCallbackFire = true; }),
- bind([&] { didRejectCallbackFire = true; }));
+ authorize("/top/prefix", *command, ¶ms,
+ bind([&] { didAcceptCallbackFire = true; }),
+ bind([&] { didRejectCallbackFire = true; }));
};
testAuthorization();