From 79c70b31a3e30cb4fc25d46143ef6fdfeae49a6d Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sun, 26 Apr 2020 01:47:47 +0900 Subject: [PATCH] Fix tests --- BTCPayServer.Tests/PayJoinTests.cs | 6 +++--- BTCPayServer.Tests/SeleniumTester.cs | 4 ++-- BTCPayServer.Tests/SeleniumTests.cs | 4 ++-- BTCPayServer/Controllers/StoresController.BTCLike.cs | 6 ------ 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/BTCPayServer.Tests/PayJoinTests.cs b/BTCPayServer.Tests/PayJoinTests.cs index 87903f435..29bb318da 100644 --- a/BTCPayServer.Tests/PayJoinTests.cs +++ b/BTCPayServer.Tests/PayJoinTests.cs @@ -184,7 +184,7 @@ namespace BTCPayServer.Tests var receiverWalletId = new WalletId(receiver.storeId, "BTC"); //payjoin is not enabled by default. - var invoiceId = s.CreateInvoice(receiver.storeId); + var invoiceId = s.CreateInvoice(receiver.storeName); s.GoToInvoiceCheckout(invoiceId); var bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn")) .GetAttribute("href"); @@ -203,7 +203,7 @@ namespace BTCPayServer.Tests await s.Server.ExplorerNode.GenerateAsync(1); await s.FundStoreWallet(senderWalletId); - invoiceId = s.CreateInvoice(receiver.storeId); + invoiceId = s.CreateInvoice(receiver.storeName); s.GoToInvoiceCheckout(invoiceId); bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn")) .GetAttribute("href"); @@ -238,7 +238,7 @@ namespace BTCPayServer.Tests StringComparison.InvariantCultureIgnoreCase)); //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); bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn")) .GetAttribute("href"); diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index f654185c4..b137f4fbc 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -298,7 +298,7 @@ namespace BTCPayServer.Tests 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(); Driver.FindElement(By.Id("CreateNewInvoice")).Click(); @@ -307,7 +307,7 @@ namespace BTCPayServer.Tests currencyEl.Clear(); currencyEl.SendKeys(currency); 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(); Assert.True(Driver.PageSource.Contains("just created!"), "Unable to create Invoice"); var statusElement = Driver.FindElement(By.ClassName("alert-success")); diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index 60ad24853..4aef8fd67 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -540,7 +540,7 @@ namespace BTCPayServer.Tests 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 address = invoice.EntityToDTO().Addresses["BTC"]; @@ -553,7 +553,7 @@ namespace BTCPayServer.Tests //lets import and save private keys var root = mnemonic.DeriveExtKey(); - invoiceId = s.CreateInvoice(storeId.storeId); + invoiceId = s.CreateInvoice(storeId.storeName); invoice = await s.Server.PayTester.InvoiceRepository.GetInvoice( invoiceId); address = invoice.EntityToDTO().Addresses["BTC"]; result = await s.Server.ExplorerNode.GetAddressInfoAsync(BitcoinAddress.Create(address, Network.RegTest)); diff --git a/BTCPayServer/Controllers/StoresController.BTCLike.cs b/BTCPayServer/Controllers/StoresController.BTCLike.cs index 0f065d633..9d49bca49 100644 --- a/BTCPayServer/Controllers/StoresController.BTCLike.cs +++ b/BTCPayServer/Controllers/StoresController.BTCLike.cs @@ -334,15 +334,12 @@ namespace BTCPayServer.Controllers public async Task GenerateNBXWallet(string storeId, string cryptoCode, GenerateWalletRequest request) { - Logs.Events.LogInformation($"GenerateNBXWallet called {storeId}, {cryptoCode}"); var hotWallet = await CanUseHotWallet(); if (!hotWallet.HotWallet || (!hotWallet.RPCImport && request.ImportKeysToRPC)) { return NotFound(); } - Logs.Events.LogInformation($"GenerateNBXWallet after CanUseHotWallet"); - var network = _NetworkProvider.GetNetwork(cryptoCode); var client = _ExplorerProvider.GetExplorerClient(cryptoCode); GenerateWalletResponse response; @@ -370,8 +367,6 @@ namespace BTCPayServer.Controllers return RedirectToAction(nameof(AddDerivationScheme), new {storeId, cryptoCode}); } - Logs.Events.LogInformation($"GenerateNBXWallet after GenerateWalletAsync"); - var store = HttpContext.GetStoreData(); var result = await AddDerivationScheme(storeId, new DerivationSchemeViewModel() @@ -408,7 +403,6 @@ namespace BTCPayServer.Controllers Html = "Please check your addresses and confirm" }); } - Logs.Events.LogInformation($"GenerateNBXWallet returning success result"); return result; }