Adding logging to detect failure of CanManageWallet test

If all logs are present it's possibly issue with TempData
This commit is contained in:
rockstardev 2020-03-18 18:17:21 -05:00
parent 65d26ad8a1
commit 47c1164003
2 changed files with 13 additions and 3 deletions

View File

@ -126,7 +126,6 @@ namespace BTCPayServer.Tests
Driver.FindElement(By.Id($"Modify{cryptoCode}")).ForceClick();
Driver.FindElement(By.Id("import-from-btn")).ForceClick();
Driver.FindElement(By.Id("nbxplorergeneratewalletbtn")).ForceClick();
Thread.Sleep(200); // allow for modal to fade in
Driver.WaitForElement(By.Id("ExistingMnemonic")).SendKeys(seed);
SetCheckbox(Driver.FindElement(By.Id("SavePrivateKeys")), privkeys);
SetCheckbox(Driver.FindElement(By.Id("ImportKeysToRPC")), importkeys);

View File

@ -22,6 +22,8 @@ using NBXplorer.DerivationStrategy;
using NBXplorer.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using BTCPayServer.Logging;
using Microsoft.Extensions.Logging;
namespace BTCPayServer.Controllers
{
@ -328,11 +330,15 @@ namespace BTCPayServer.Controllers
public async Task<IActionResult> GenerateNBXWallet(string storeId, string cryptoCode,
GenerateWalletRequest request)
{
Logs.Events.LogInformation($"GenerateNBXWallet called {storeId}, {cryptoCode}, {request.ToJson()}");
if (!await CanUseHotWallet())
{
return NotFound();
}
Logs.Events.LogInformation($"GenerateNBXWallet after CanUseHotWallet");
var network = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
var client = _ExplorerProvider.GetExplorerClient(cryptoCode);
var response = await client.GenerateWalletAsync(request);
@ -345,6 +351,9 @@ namespace BTCPayServer.Controllers
});
return RedirectToAction("AddDerivationScheme", new {storeId, cryptoCode});
}
Logs.Events.LogInformation($"GenerateNBXWallet after GenerateWalletAsync");
var store = HttpContext.GetStoreData();
var result = await AddDerivationScheme(storeId,
new DerivationSchemeViewModel()
@ -362,7 +371,7 @@ namespace BTCPayServer.Controllers
Enabled = !store.GetStoreBlob()
.IsExcluded(new PaymentMethodId(cryptoCode, PaymentTypes.BTCLike))
}, cryptoCode);
TempData.SetStatusMessageModel(new StatusMessageModel()
{
Severity = StatusMessageModel.StatusSeverity.Success,
@ -370,6 +379,8 @@ namespace BTCPayServer.Controllers
? "Your wallet has been imported."
: $"Your wallet has been generated. Please store your seed securely! <br/><code>{response.Mnemonic}</code>"
});
Logs.Events.LogInformation($"GenerateNBXWallet returning success result");
return result;
}