add else tests

This commit is contained in:
Kukks 2020-03-16 08:13:44 +01:00
parent cc0202ecb3
commit ff2ea5815c

View file

@ -224,6 +224,12 @@ namespace BTCPayServer.Tests
tester.PayTester.HttpClient);
});
}
else
{
await TestApiAgainstAccessToken<bool>(accessToken,
$"{TestApiPath}/me/stores/{testAccount.StoreId}/can-edit",
tester.PayTester.HttpClient);
}
if (!permissions.Contains(Permissions.ServerManagement))
{
@ -233,6 +239,11 @@ namespace BTCPayServer.Tests
tester.PayTester.HttpClient);
});
}
else
{
await TestApiAgainstAccessToken<bool>(accessToken, $"{TestApiPath}/me/stores/{secondUser.StoreId}/can-edit",
tester.PayTester.HttpClient);
}
if (permissions.Contains(Permissions.ServerManagement))
{
@ -240,6 +251,15 @@ namespace BTCPayServer.Tests
$"{TestApiPath}/me/is-admin",
tester.PayTester.HttpClient));
}
else
{
await Assert.ThrowsAnyAsync<HttpRequestException>(async () =>
{
await TestApiAgainstAccessToken<bool>(accessToken,
$"{TestApiPath}/me/is-admin",
tester.PayTester.HttpClient);
});
}
}
public async Task<T> TestApiAgainstAccessToken<T>(string apikey, string url, HttpClient client)