Skip to content

Commit

Permalink
Use test configuration for exchange public / private API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanel committed Apr 4, 2022
1 parent 9c467fe commit 0e8b24e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
20 changes: 8 additions & 12 deletions src/api/common/test/exchangeprivateapi_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ namespace cct::api {

class ExchangePrivateTest : public ::testing::Test {
protected:
ExchangePrivateTest()
: cryptowatchAPI(coincenterInfo, settings::RunMode::kProd, Duration::max(), true),
fiatConverter(coincenterInfo, Duration::max()), // max to avoid real Fiat converter queries
exchangePublic(kSupportedExchanges[0], fiatConverter, cryptowatchAPI, coincenterInfo),
key("test", "testuser", "", "", ""),
exchangePrivate(exchangePublic, coincenterInfo, key) {}
ExchangePrivateTest() = default;

virtual void SetUp() {}

Expand All @@ -33,12 +28,13 @@ class ExchangePrivateTest : public ::testing::Test {
EXPECT_CALL(exchangePublic, queryTradableMarkets()).WillOnce(testing::Return(ExchangePublic::MarketSet{m}));
}

CoincenterInfo coincenterInfo;
CryptowatchAPI cryptowatchAPI;
FiatConverter fiatConverter;
MockExchangePublic exchangePublic;
APIKey key;
MockExchangePrivate exchangePrivate;
LoadConfiguration loadConfiguration{kDefaultDataDir, LoadConfiguration::ExchangeConfigFileType::kTest};
CoincenterInfo coincenterInfo{settings::RunMode::kProd, loadConfiguration};
CryptowatchAPI cryptowatchAPI{coincenterInfo, settings::RunMode::kProd, Duration::max(), true};
FiatConverter fiatConverter{coincenterInfo, Duration::max()}; // max to avoid real Fiat converter queries
MockExchangePublic exchangePublic{kSupportedExchanges[0], fiatConverter, cryptowatchAPI, coincenterInfo};
APIKey key{"test", "testuser", "", "", ""};
MockExchangePrivate exchangePrivate{exchangePublic, coincenterInfo, key};

Market m{"ETH", "EUR"};

Expand Down
3 changes: 2 additions & 1 deletion src/api/common/test/exchangepublicapi_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class ExchangePublicTest : public ::testing::Test {
virtual void SetUp() {}
virtual void TearDown() {}

CoincenterInfo coincenterInfo;
LoadConfiguration loadConfiguration{kDefaultDataDir, LoadConfiguration::ExchangeConfigFileType::kTest};
CoincenterInfo coincenterInfo{settings::RunMode::kProd, loadConfiguration};
CryptowatchAPI cryptowatchAPI{coincenterInfo};
FiatConverter fiatConverter{coincenterInfo, Duration::max()}; // max to avoid real Fiat converter queries
MockExchangePublic exchangePublic{kSupportedExchanges[0], fiatConverter, cryptowatchAPI, coincenterInfo};
Expand Down

0 comments on commit 0e8b24e

Please sign in to comment.