Skip to content

Commit

Permalink
Changed peer comparison
Browse files Browse the repository at this point in the history
Signed-off-by: artyom-yurin <artem_yrin@mail.ru>
  • Loading branch information
ortyomka authored and MBoldyrev committed Oct 2, 2019
1 parent 9a87710 commit 6055bdf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions test/integration/acceptance/fake_peer_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ auto makePeerPointeeMatcher(shared_model::interface::types::AddressType address,

auto makePeerPointeeMatcher(
std::shared_ptr<shared_model::interface::Peer> peer) {
// TODO [IR-658] artyom-yurin 30.09.2019: Rewrite using operator ==
return makePeerPointeeMatcher(peer->address(), peer->pubkey());
}

Expand Down
25 changes: 14 additions & 11 deletions test/module/irohad/ametsuchi/wsv_query_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "ametsuchi/impl/postgres_wsv_command.hpp"
#include "ametsuchi/impl/postgres_wsv_query.hpp"
#include "framework/test_logger.hpp"
#include "integration/acceptance/fake_peer_fixture.hpp"
#include "module/irohad/ametsuchi/ametsuchi_fixture.hpp"

namespace iroha {
Expand Down Expand Up @@ -46,20 +47,22 @@ namespace iroha {
* @then peer list successfully received
*/
TEST_F(WsvQueryTest, GetPeers) {
shared_model::plain::Peer peer1(
"some-address", shared_model::crypto::PublicKey("some-public-key"));
command->insertPeer(peer1);
shared_model::plain::Peer peer2(
"another-address",
shared_model::crypto::PublicKey("another-public-key"));
command->insertPeer(peer2);
std::shared_ptr<shared_model::interface::Peer> peer1 =
std::make_shared<shared_model::plain::Peer>(
"some-address",
shared_model::crypto::PublicKey("some-public-key"));
command->insertPeer(*peer1);
std::shared_ptr<shared_model::interface::Peer> peer2 =
std::make_shared<shared_model::plain::Peer>(
"another-address",
shared_model::crypto::PublicKey("another-public-key"));
command->insertPeer(*peer2);

auto result = query->getPeers();
ASSERT_TRUE(result);
auto peers = result.get();
ASSERT_EQ(peers.size(), 2);
ASSERT_EQ(*peers[0], peer1);
ASSERT_EQ(*peers[1], peer2);
ASSERT_THAT(*result,
testing::ElementsAre(makePeerPointeeMatcher(peer1),
makePeerPointeeMatcher(peer2)));
}

/**
Expand Down

0 comments on commit 6055bdf

Please sign in to comment.