use of network.bisq.api.model.Preferences in project bisq-api by mrosseel.
the class PreferencesResourceIT method setPreferences_validPayload_returns200.
@InSequence(1)
@Test
public void setPreferences_validPayload_returns200() {
savedPreferences = new Preferences();
savedPreferences.autoSelectArbitrators = false;
savedPreferences.baseCurrencyNetwork = "BTC";
savedPreferences.blockChainExplorer = "Smartbit";
savedPreferences.cryptoCurrencies = Arrays.asList("BCH", "ETH");
savedPreferences.fiatCurrencies = Arrays.asList("PLN", "EUR", "USD");
savedPreferences.ignoredTraders = Arrays.asList("jes.onion:9999", "ber:3333");
savedPreferences.maxPriceDistance = 0.5;
savedPreferences.preferredTradeCurrency = "PLN";
savedPreferences.useCustomWithdrawalTxFee = true;
savedPreferences.userCountry = "GB";
savedPreferences.userLanguage = "PL";
savedPreferences.withdrawalTxFee = 200L;
given().port(getAlicePort()).body(savedPreferences).contentType(ContentType.JSON).when().put("/api/v1/preferences").then().statusCode(200).body("autoSelectArbitrators", equalTo(savedPreferences.autoSelectArbitrators)).body("baseCurrencyNetwork", equalTo(savedPreferences.baseCurrencyNetwork)).body("blockChainExplorer", equalTo(savedPreferences.blockChainExplorer)).body("cryptoCurrencies", equalTo(savedPreferences.cryptoCurrencies)).body("fiatCurrencies", equalTo(savedPreferences.fiatCurrencies)).body("ignoredTraders", equalTo(Arrays.asList("jes", "ber:3333"))).body("maxPriceDistance", equalTo(savedPreferences.maxPriceDistance.floatValue())).body("preferredTradeCurrency", equalTo(savedPreferences.preferredTradeCurrency)).body("useCustomWithdrawalTxFee", equalTo(savedPreferences.useCustomWithdrawalTxFee)).body("userCountry", equalTo(savedPreferences.userCountry)).body("userLanguage", equalTo(savedPreferences.userLanguage)).body("withdrawalTxFee", equalTo(savedPreferences.withdrawalTxFee.intValue()));
}
use of network.bisq.api.model.Preferences in project bisq-api by mrosseel.
the class PreferencesResourceIT method setPreferences_invalidBlockChainExplorer_returns422.
@InSequence(3)
@Test
public void setPreferences_invalidBlockChainExplorer_returns422() {
final Preferences preferences = new Preferences();
preferences.blockChainExplorer = "abc";
given().port(getAlicePort()).body(preferences).contentType(ContentType.JSON).when().put("/api/v1/preferences").then().statusCode(422).body("errors.size()", equalTo(1)).body("errors[0]", equalTo("Unsupported value of blockChainExplorer: abc"));
getPreferences_always_returns200();
}
use of network.bisq.api.model.Preferences in project bisq-api by mrosseel.
the class PreferencesResourceIT method setPreferences_nullCryptoCurrencyCode_returns422.
@InSequence(3)
@Test
public void setPreferences_nullCryptoCurrencyCode_returns422() {
final Preferences preferences = new Preferences();
preferences.cryptoCurrencies = Collections.singletonList(null);
given().port(getAlicePort()).body(preferences).contentType(ContentType.JSON).when().put("/api/v1/preferences").then().statusCode(422).body("errors.size()", equalTo(1)).body("errors[0]", equalTo("Unsupported crypto currency code: null"));
getPreferences_always_returns200();
}
Aggregations