tests: sign command Interests with CommandInterestSigner

Previously used ndn::v2::KeyChain::sign creates signed Interests, not
command Interests.

refs #4089

Change-Id: I7b13926d676ff81041f036eaec1978d82e8e1dfd
This commit is contained in:
Junxiao Shi
2017-07-03 00:05:08 +00:00
parent 83be1dae4b
commit 8a1f170ea6
13 changed files with 190 additions and 226 deletions
@@ -24,16 +24,15 @@
*/
#include "mgmt/command-authenticator.hpp"
#include <ndn-cxx/security/signing-helpers.hpp>
#include <boost/filesystem.hpp>
#include "tests/test-common.hpp"
#include "tests/identity-management-fixture.hpp"
#include "tests/manager-common-fixture.hpp"
namespace nfd {
namespace tests {
class CommandAuthenticatorFixture : public IdentityManagementTimeFixture
class CommandAuthenticatorFixture : public CommandInterestSignerFixture
{
protected:
CommandAuthenticatorFixture()
@@ -63,17 +62,17 @@ protected:
authorize(const std::string& module, const Name& identity,
const function<void(Interest&)>& modifyInterest = nullptr)
{
auto interest = makeInterest(Name("/prefix").append(module).append("verb"));
m_keyChain.sign(*interest, signingByIdentity(identity));
Interest interest = this->makeControlCommandRequest(Name("/prefix/" + module + "/verb"),
ControlParameters(), identity);
if (modifyInterest != nullptr) {
modifyInterest(*interest);
modifyInterest(interest);
}
ndn::mgmt::Authorization authorization = authorizations.at(module);
bool isAccepted = false;
bool isRejected = false;
authorization(Name("/prefix"), *interest, nullptr,
authorization(Name("/prefix"), interest, nullptr,
[this, &isAccepted, &isRejected] (const std::string& requester) {
BOOST_REQUIRE_MESSAGE(!isAccepted && !isRejected,
"authorization function should invoke only one continuation");