Search in sources :

Example 6 with Preferences

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();
}
Also used : Preferences(network.bisq.api.model.Preferences) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 7 with Preferences

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));
    }
}
Also used : ArrayList(java.util.ArrayList) Preferences(network.bisq.api.model.Preferences) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 8 with Preferences

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();
}
Also used : Preferences(network.bisq.api.model.Preferences) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 9 with Preferences

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();
}
Also used : Preferences(network.bisq.api.model.Preferences) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 10 with Preferences

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();
}
Also used : Preferences(network.bisq.api.model.Preferences) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Aggregations

Preferences (network.bisq.api.model.Preferences)13 InSequence (org.jboss.arquillian.junit.InSequence)12 Test (org.junit.Test)12 Country (bisq.core.locale.Country)1 ArrayList (java.util.ArrayList)1