engine/gRPC: Add update account info to grpc interface (#602)

* Add update account info to grpc interface

* Fix lbank tests

* Review corrections

* Review corrections

* Fix linter
This commit is contained in:
Mikhail Shogin
2020-11-30 01:29:31 +01:00
committed by GitHub
parent b7d99f741d
commit ba4ac4f3d6
13 changed files with 416 additions and 100 deletions

View File

@@ -785,3 +785,36 @@ func TestGetHistoricTrades(t *testing.T) {
t.Error(err)
}
}
func TestGetAccountInfo(t *testing.T) {
bot := SetupTestHelpers(t)
s := RPCServer{Engine: bot}
r, err := s.GetAccountInfo(context.Background(), &gctrpc.GetAccountInfoRequest{Exchange: fakePassExchange})
if err != nil {
t.Fatalf("TestGetAccountInfo: Failed to get account info: %s", err)
}
if r.Accounts[0].Currencies[0].TotalValue != 10 {
t.Fatal("TestGetAccountInfo: Unexpected value of the 'TotalValue'")
}
}
func TestUpdateAccountInfo(t *testing.T) {
bot := SetupTestHelpers(t)
s := RPCServer{Engine: bot}
getResponse, err := s.GetAccountInfo(context.Background(), &gctrpc.GetAccountInfoRequest{Exchange: fakePassExchange})
if err != nil {
t.Fatalf("TestGetAccountInfo: Failed to get account info: %s", err)
}
updateResponse, err := s.UpdateAccountInfo(context.Background(), &gctrpc.GetAccountInfoRequest{Exchange: fakePassExchange})
if err != nil {
t.Fatalf("TestGetAccountInfo: Failed to update account info: %s", err)
}
if getResponse.Accounts[0].Currencies[0].TotalValue == updateResponse.Accounts[0].Currencies[0].TotalValue {
t.Fatalf("TestGetAccountInfo: Unexpected value of the 'TotalValue'")
}
}