Fix changelly tests

This commit is contained in:
nicolas.dorier 2018-10-28 01:10:07 +09:00
parent a8ba1ed1ed
commit c46c15c258

View File

@ -83,6 +83,7 @@ namespace BTCPayServer.Tests
ApiKey = "key",
ApiUrl = "http://gozo.com",
ChangellyMerchantId = "aaa",
Enabled = true
};
Assert.Equal("UpdateStore", Assert.IsType<RedirectToActionResult>(
await controller.UpdateChangellySettings(user.StoreId, updateModel, "save")).ActionName);
@ -120,10 +121,7 @@ namespace BTCPayServer.Tests
.IsType<BadRequestObjectResult>(await changellyController.GetCurrencyList(user.StoreId))
.Value);
var updateModel = new UpdateChangellySettingsViewModel
{
Enabled = false
};
var updateModel = CreateDefaultChangellyParams(false);
var storesController = tester.PayTester.GetController<StoresController>(user.UserId, user.StoreId);
//set payment method but disabled
@ -150,6 +148,16 @@ namespace BTCPayServer.Tests
}
}
UpdateChangellySettingsViewModel CreateDefaultChangellyParams(bool enabled)
{
return new UpdateChangellySettingsViewModel()
{
ApiKey = "6ed02cdf1b614d89a8c0ceb170eebb61",
ApiSecret = "8fbd66a2af5fd15a6b5f8ed0159c5842e32a18538521ffa145bd6c9e124d3483",
ChangellyMerchantId = "804298eb5753",
Enabled = enabled
};
}
[Fact]
public async void CanGetCurrencyListFromChangelly()
@ -161,10 +169,7 @@ namespace BTCPayServer.Tests
user.GrantAccess();
//save changelly settings
var updateModel = new UpdateChangellySettingsViewModel()
{
Enabled = true
};
var updateModel = CreateDefaultChangellyParams(true);
var storesController = tester.PayTester.GetController<StoresController>(user.UserId, user.StoreId);
//confirm saved
@ -195,10 +200,7 @@ namespace BTCPayServer.Tests
var user = tester.NewAccount();
user.GrantAccess();
var updateModel = new UpdateChangellySettingsViewModel()
{
Enabled = true
};
var updateModel = CreateDefaultChangellyParams(true);
var storesController = tester.PayTester.GetController<StoresController>(user.UserId, user.StoreId);
Assert.Equal("UpdateStore", Assert.IsType<RedirectToActionResult>(