зеркало из https://github.com/aspnet/MusicStore.git
Fixed test
This commit is contained in:
Родитель
146cf8e095
Коммит
116593f091
|
@ -62,7 +62,7 @@ namespace MusicStore
|
||||||
|
|
||||||
services.ConfigureCookieAuthentication(options =>
|
services.ConfigureCookieAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.AccessDeniedPath = new PathString("/Home/AccessDenied");
|
options.AccessDeniedPath = new PathString("~/Home/AccessDenied");
|
||||||
});
|
});
|
||||||
|
|
||||||
services.ConfigureFacebookAuthentication(options =>
|
services.ConfigureFacebookAuthentication(options =>
|
||||||
|
|
|
@ -142,13 +142,12 @@ namespace E2ETests
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Trying to access StoreManager that needs ManageStore claim with the current user : {email}", email ?? "Anonymous");
|
_logger.LogInformation("Trying to access StoreManager that needs ManageStore claim with the current user : {email}", email ?? "Anonymous");
|
||||||
var response = await _httpClient.GetAsync("Admin/StoreManager/");
|
var response = await _httpClient.GetAsync("Admin/StoreManager/");
|
||||||
|
|
||||||
if (email == null)
|
|
||||||
{
|
|
||||||
await ThrowIfResponseStatusNotOk(response);
|
await ThrowIfResponseStatusNotOk(response);
|
||||||
var responseContent = await response.Content.ReadAsStringAsync();
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
ValidateLayoutPage(responseContent);
|
ValidateLayoutPage(responseContent);
|
||||||
|
|
||||||
|
if (email == null)
|
||||||
|
{
|
||||||
Assert.Contains("<title>Log in – ASP.NET MVC Music Store</title>", responseContent, StringComparison.OrdinalIgnoreCase);
|
Assert.Contains("<title>Log in – ASP.NET MVC Music Store</title>", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||||
Assert.Contains("<h4>Use a local account to log in.</h4>", responseContent, StringComparison.OrdinalIgnoreCase);
|
Assert.Contains("<h4>Use a local account to log in.</h4>", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||||
Assert.Equal<string>(_deploymentResult.ApplicationBaseUri + PrefixBaseAddress("Account/Login?ReturnUrl=%2F{0}%2FAdmin%2FStoreManager%2F"), response.RequestMessage.RequestUri.AbsoluteUri);
|
Assert.Equal<string>(_deploymentResult.ApplicationBaseUri + PrefixBaseAddress("Account/Login?ReturnUrl=%2F{0}%2FAdmin%2FStoreManager%2F"), response.RequestMessage.RequestUri.AbsoluteUri);
|
||||||
|
@ -156,10 +155,6 @@ namespace E2ETests
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await ThrowIfResponseStatusNotOk(response);
|
|
||||||
var responseContent = await response.Content.ReadAsStringAsync();
|
|
||||||
ValidateLayoutPage(responseContent);
|
|
||||||
|
|
||||||
Assert.Contains("<title>Access denied due to insufficient permissions – ASP.NET MVC Music Store</title>", responseContent, StringComparison.OrdinalIgnoreCase);
|
Assert.Contains("<title>Access denied due to insufficient permissions – ASP.NET MVC Music Store</title>", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче