lokinet/test/api_unittest.cpp

27 lines
525 B
C++
Raw Normal View History

2018-06-23 00:00:44 +00:00
#include <gtest/gtest.h>
#include <llarp/api/messages.hpp>
class APITest : public ::testing::Test
{
public:
llarp_crypto crypto;
std::string apiPassword = "password";
APITest()
{
llarp_crypto_libsodium_init(&crypto);
}
~APITest()
{
}
};
TEST_F(APITest, TestMessageWellFormed)
{
llarp::api::CreateSessionMessage msg;
msg.msgID = 0;
msg.sessionID = 12345;
msg.CalculateHash(&crypto, apiPassword);
llarp::Info("msghash=", msg.hash);
ASSERT_TRUE(msg.IsWellFormed(&crypto, apiPassword));
};