Skip to content

Commit

Permalink
Fix (unused variable, NO_KEY renamed to NO_ACCOUNT)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsa authored and muratovv committed Aug 2, 2017
1 parent 57984f2 commit 79b817f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions iroha-cli/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ namespace iroha_cli {
std::string client_priv_key_;
std::ifstream priv_file(model_tx.creator_account_id + ".priv");
if (not priv_file) {
return NO_KEYS;
return NO_ACCOUNT;
}
priv_file >> client_priv_key_;
priv_file.close();

std::ifstream pub_file(model_tx.creator_account_id + ".pub");
if (not pub_file) {
return NO_KEYS;
return NO_ACCOUNT;
}
pub_file >> client_pub_key_;
pub_file.close();
Expand Down
2 changes: 1 addition & 1 deletion iroha-cli/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace iroha_cli {
public:
enum Status {
WRONG_FORMAT,
NO_KEYS,
NO_ACCOUNT,
NOT_VALID,
OK
};
Expand Down
2 changes: 1 addition & 1 deletion iroha-cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {
break;
case iroha_cli::CliClient::WRONG_FORMAT: std::cout << "Transaction wrong json format" << std::endl;
break;
case iroha_cli::CliClient::NO_KEYS: std::cout << "No public and private key found. Run with new_account flag." << std::endl;
case iroha_cli::CliClient::NO_ACCOUNT: std::cout << "No public and private key found. Run with new_account flag." << std::endl;
break;
case iroha_cli::CliClient::NOT_VALID: std::cout << "Transaction is not valid." << std::endl;
break;
Expand Down
5 changes: 2 additions & 3 deletions test/module/iroha-cli/client_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ TEST_F(ClientTest, SendTxWhenStatelessInvalid) {


TEST_F(ClientTest, SendTxWhenNoKeys) {
std::string account_name = "test";
// Client without public, private keys
iroha_cli::CliClient client(Ip, Port);
EXPECT_CALL(svMock, validate(A<const iroha::model::Transaction &>()))
Expand All @@ -169,5 +168,5 @@ TEST_F(ClientTest, SendTxWhenNoKeys) {
" }]\n"
"}";
std::cout << "Sending json transaction to Iroha" << std::endl;
ASSERT_EQ(client.sendTx(json_tx), iroha_cli::CliClient::NO_KEYS);
}
ASSERT_EQ(client.sendTx(json_tx), iroha_cli::CliClient::NO_ACCOUNT);
}

0 comments on commit 79b817f

Please sign in to comment.