web3-proxy/web3_proxy/tests/common/get_user_balance.rs
David 8d31680ff1
David/referral test new (#162)
* working on test for referral

* refactored logic in tests to helper functions

* added getbalance helper

* added more helper functions to test for referral

* gotta be able to submit to rpc now

* adding provider instead

* referral tests are not passing, may be because we need for stats to be updated

* balance doesnt decrease

* will look into deposits in the meantime

* finding some first bugs

* seems to have fixed a bunch of stuff

* feedback, lint, and make it compile

---------

Co-authored-by: Bryan Stitt <bryan@llamanodes.com>
2023-07-05 22:18:39 -07:00

27 lines
748 B
Rust

use crate::TestApp;
use tracing::info;
use web3_proxy::frontend::users::authentication::LoginPostResponse;
/// Helper function to get the user's balance
#[allow(unused)]
pub async fn user_get_balance(
x: &TestApp,
r: &reqwest::Client,
login_response: &LoginPostResponse,
) -> (serde_json::Value) {
let get_user_balance = format!("{}user/balance", x.proxy_provider.url());
info!("Get balance");
let balance_response = r
.get(get_user_balance)
.bearer_auth(login_response.bearer_token)
.send()
.await
.unwrap();
info!(?balance_response);
let balance_response = balance_response.json::<serde_json::Value>().await.unwrap();
info!(?balance_response);
balance_response
}