Files
rippled/src/test/rpc/ManifestRPC_test.cpp
Bart 1d42c4f6de refactor: Remove unnecessary copyright notices already covered by LICENSE.md (#5929)
Per XLS-0095, we are taking steps to rename ripple(d) to xrpl(d).

This change specifically removes all copyright notices referencing Ripple, XRPLF, and certain affiliated contributors upon mutual agreement, so the notice in the LICENSE.md file applies throughout. Copyright notices referencing external contributions remain as-is. Duplicate verbiage is also removed.
2025-11-04 08:33:42 +00:00

79 lines
1.9 KiB
C++

// Copyright (c) 2020 Dev Null Productions
#include <test/jtx.h>
#include <xrpld/core/ConfigSections.h>
#include <xrpl/beast/unit_test.h>
#include <xrpl/protocol/jss.h>
#include <string>
namespace ripple {
namespace test {
class ManifestRPC_test : public beast::unit_test::suite
{
public:
void
testErrors()
{
testcase("Errors");
using namespace jtx;
Env env(*this);
{
// manifest with no public key
auto const info = env.rpc("json", "manifest", "{ }");
BEAST_EXPECT(
info[jss::result][jss::error_message] ==
"Missing field 'public_key'.");
}
{
// manifest with manlformed public key
auto const info = env.rpc(
"json",
"manifest",
"{ \"public_key\": "
"\"abcdef12345\"}");
BEAST_EXPECT(
info[jss::result][jss::error_message] == "Invalid parameters.");
}
}
void
testLookup()
{
testcase("Lookup");
using namespace jtx;
std::string const key =
"n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7";
Env env{*this, envconfig([&key](std::unique_ptr<Config> cfg) {
cfg->section(SECTION_VALIDATORS).append(key);
return cfg;
})};
{
auto const info = env.rpc(
"json",
"manifest",
"{ \"public_key\": "
"\"" +
key + "\"}");
BEAST_EXPECT(info[jss::result][jss::requested] == key);
BEAST_EXPECT(info[jss::result][jss::status] == "success");
}
}
void
run() override
{
testErrors();
testLookup();
}
};
BEAST_DEFINE_TESTSUITE(ManifestRPC, rpc, ripple);
} // namespace test
} // namespace ripple