Fix tests

This commit is contained in:
nicolas.dorier 2020-04-26 01:47:47 +09:00
parent 072139f707
commit 79c70b31a3
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
4 changed files with 7 additions and 13 deletions

View File

@ -184,7 +184,7 @@ namespace BTCPayServer.Tests
var receiverWalletId = new WalletId(receiver.storeId, "BTC"); var receiverWalletId = new WalletId(receiver.storeId, "BTC");
//payjoin is not enabled by default. //payjoin is not enabled by default.
var invoiceId = s.CreateInvoice(receiver.storeId); var invoiceId = s.CreateInvoice(receiver.storeName);
s.GoToInvoiceCheckout(invoiceId); s.GoToInvoiceCheckout(invoiceId);
var bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn")) var bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn"))
.GetAttribute("href"); .GetAttribute("href");
@ -203,7 +203,7 @@ namespace BTCPayServer.Tests
await s.Server.ExplorerNode.GenerateAsync(1); await s.Server.ExplorerNode.GenerateAsync(1);
await s.FundStoreWallet(senderWalletId); await s.FundStoreWallet(senderWalletId);
invoiceId = s.CreateInvoice(receiver.storeId); invoiceId = s.CreateInvoice(receiver.storeName);
s.GoToInvoiceCheckout(invoiceId); s.GoToInvoiceCheckout(invoiceId);
bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn")) bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn"))
.GetAttribute("href"); .GetAttribute("href");
@ -238,7 +238,7 @@ namespace BTCPayServer.Tests
StringComparison.InvariantCultureIgnoreCase)); StringComparison.InvariantCultureIgnoreCase));
//let's do it all again, except now the receiver has funds and is able to payjoin //let's do it all again, except now the receiver has funds and is able to payjoin
invoiceId = s.CreateInvoice(receiver.storeId); invoiceId = s.CreateInvoice(receiver.storeName);
s.GoToInvoiceCheckout(invoiceId); s.GoToInvoiceCheckout(invoiceId);
bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn")) bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn"))
.GetAttribute("href"); .GetAttribute("href");

View File

@ -298,7 +298,7 @@ namespace BTCPayServer.Tests
Driver.FindElement(By.Id("CreateNewInvoice")).Click(); Driver.FindElement(By.Id("CreateNewInvoice")).Click();
} }
public string CreateInvoice(string store, decimal amount = 100, string currency = "USD", string refundEmail = "") public string CreateInvoice(string storeName, decimal amount = 100, string currency = "USD", string refundEmail = "")
{ {
GoToInvoices(); GoToInvoices();
Driver.FindElement(By.Id("CreateNewInvoice")).Click(); Driver.FindElement(By.Id("CreateNewInvoice")).Click();
@ -307,7 +307,7 @@ namespace BTCPayServer.Tests
currencyEl.Clear(); currencyEl.Clear();
currencyEl.SendKeys(currency); currencyEl.SendKeys(currency);
Driver.FindElement(By.Id("BuyerEmail")).SendKeys(refundEmail); Driver.FindElement(By.Id("BuyerEmail")).SendKeys(refundEmail);
Driver.FindElement(By.Name("StoreId")).SendKeys(store + Keys.Enter); Driver.FindElement(By.Name("StoreId")).SendKeys(storeName + Keys.Enter);
Driver.FindElement(By.Id("Create")).ForceClick(); Driver.FindElement(By.Id("Create")).ForceClick();
Assert.True(Driver.PageSource.Contains("just created!"), "Unable to create Invoice"); Assert.True(Driver.PageSource.Contains("just created!"), "Unable to create Invoice");
var statusElement = Driver.FindElement(By.ClassName("alert-success")); var statusElement = Driver.FindElement(By.ClassName("alert-success"));

View File

@ -540,7 +540,7 @@ namespace BTCPayServer.Tests
Assert.NotEqual( receiveAddr, s.Driver.FindElement(By.Id("vue-address")).GetAttribute("value")); Assert.NotEqual( receiveAddr, s.Driver.FindElement(By.Id("vue-address")).GetAttribute("value"));
var invoiceId = s.CreateInvoice(storeId.storeId); var invoiceId = s.CreateInvoice(storeId.storeName);
var invoice = await s.Server.PayTester.InvoiceRepository.GetInvoice(invoiceId); var invoice = await s.Server.PayTester.InvoiceRepository.GetInvoice(invoiceId);
var address = invoice.EntityToDTO().Addresses["BTC"]; var address = invoice.EntityToDTO().Addresses["BTC"];
@ -553,7 +553,7 @@ namespace BTCPayServer.Tests
//lets import and save private keys //lets import and save private keys
var root = mnemonic.DeriveExtKey(); var root = mnemonic.DeriveExtKey();
invoiceId = s.CreateInvoice(storeId.storeId); invoiceId = s.CreateInvoice(storeId.storeName);
invoice = await s.Server.PayTester.InvoiceRepository.GetInvoice( invoiceId); invoice = await s.Server.PayTester.InvoiceRepository.GetInvoice( invoiceId);
address = invoice.EntityToDTO().Addresses["BTC"]; address = invoice.EntityToDTO().Addresses["BTC"];
result = await s.Server.ExplorerNode.GetAddressInfoAsync(BitcoinAddress.Create(address, Network.RegTest)); result = await s.Server.ExplorerNode.GetAddressInfoAsync(BitcoinAddress.Create(address, Network.RegTest));

View File

@ -334,15 +334,12 @@ namespace BTCPayServer.Controllers
public async Task<IActionResult> GenerateNBXWallet(string storeId, string cryptoCode, public async Task<IActionResult> GenerateNBXWallet(string storeId, string cryptoCode,
GenerateWalletRequest request) GenerateWalletRequest request)
{ {
Logs.Events.LogInformation($"GenerateNBXWallet called {storeId}, {cryptoCode}");
var hotWallet = await CanUseHotWallet(); var hotWallet = await CanUseHotWallet();
if (!hotWallet.HotWallet || (!hotWallet.RPCImport && request.ImportKeysToRPC)) if (!hotWallet.HotWallet || (!hotWallet.RPCImport && request.ImportKeysToRPC))
{ {
return NotFound(); return NotFound();
} }
Logs.Events.LogInformation($"GenerateNBXWallet after CanUseHotWallet");
var network = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode); var network = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
var client = _ExplorerProvider.GetExplorerClient(cryptoCode); var client = _ExplorerProvider.GetExplorerClient(cryptoCode);
GenerateWalletResponse response; GenerateWalletResponse response;
@ -370,8 +367,6 @@ namespace BTCPayServer.Controllers
return RedirectToAction(nameof(AddDerivationScheme), new {storeId, cryptoCode}); return RedirectToAction(nameof(AddDerivationScheme), new {storeId, cryptoCode});
} }
Logs.Events.LogInformation($"GenerateNBXWallet after GenerateWalletAsync");
var store = HttpContext.GetStoreData(); var store = HttpContext.GetStoreData();
var result = await AddDerivationScheme(storeId, var result = await AddDerivationScheme(storeId,
new DerivationSchemeViewModel() new DerivationSchemeViewModel()
@ -408,7 +403,6 @@ namespace BTCPayServer.Controllers
Html = "Please check your addresses and confirm" Html = "Please check your addresses and confirm"
}); });
} }
Logs.Events.LogInformation($"GenerateNBXWallet returning success result");
return result; return result;
} }