use of network.bisq.api.model.Preferences in project bisq-api by mrosseel.
the class PreferencesResourceIT method setPreferences_unsupportedFiatCurrencyCode_returns422.
@InSequence(3)
@Test
public void setPreferences_unsupportedFiatCurrencyCode_returns422() {
final Preferences preferences = new Preferences();
preferences.fiatCurrencies = Collections.singletonList("BTC");
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 fiat currency code: BTC"));
getPreferences_always_returns200();
}
use of network.bisq.api.model.Preferences in project bisq-api by mrosseel.
the class CurrencyResourceIT method getPriceFeed_withoutAnyParams_returnsPricesForDefaultCurrencies.
@InSequence(1)
@Test
public void getPriceFeed_withoutAnyParams_returnsPricesForDefaultCurrencies() {
final Preferences preferences = given().port(getAlicePort()).when().get("/api/v1/preferences").then().statusCode(200).extract().as(Preferences.class);
final List<String> defaultCodes = new ArrayList<>(preferences.cryptoCurrencies);
defaultCodes.addAll(preferences.fiatCurrencies);
final HashMap<String, Double> map = given().port(getAlicePort()).when().get("/api/v1/currencies/prices").then().statusCode(200).and().body("prices.size()", greaterThan(0)).extract().path("prices");
for (String code : map.keySet()) {
Assert.assertTrue("Response should contain only default currencies", defaultCodes.contains(code));
}
}
use of network.bisq.api.model.Preferences in project bisq-api by mrosseel.
the class PreferencesResourceIT method setPreferences_unsupportedCryptoCurrencyCode_returns422.
@InSequence(3)
@Test
public void setPreferences_unsupportedCryptoCurrencyCode_returns422() {
final Preferences preferences = new Preferences();
preferences.cryptoCurrencies = Collections.singletonList("BTC");
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: BTC"));
getPreferences_always_returns200();
}
use of network.bisq.api.model.Preferences in project bisq-api by mrosseel.
the class PreferencesResourceIT method setPreferences_unsupportedUserCountry_returns422.
@InSequence(3)
@Test
public void setPreferences_unsupportedUserCountry_returns422() {
final Preferences preferences = new Preferences();
preferences.userCountry = "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("userCountry is not valid country code"));
getPreferences_always_returns200();
}
use of network.bisq.api.model.Preferences in project bisq-api by mrosseel.
the class PreferencesResourceIT method setPreferences_nullFiatCurrencyCode_returns422.
@InSequence(3)
@Test
public void setPreferences_nullFiatCurrencyCode_returns422() {
final Preferences preferences = new Preferences();
preferences.fiatCurrencies = 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 fiat currency code: null"));
getPreferences_always_returns200();
}
Aggregations