blob: ad67293b964355a279a37abfdfa5bee1f464f60f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace Timeline.Tests.IntegratedTests2
{
public static class IntegratedTestPermissionTestExtensions
{
public static async Task TestOnlySelfAndAdminCanCall(this IntegratedTestBase testBase, HttpMethod httpMethod, string selfResourceUrl, string otherResourceUrl, object? body)
{
await testBase.DefaultClient.TestJsonSendAsync(httpMethod, selfResourceUrl, body, expectedStatusCode: HttpStatusCode.Unauthorized);
await testBase.UserClient.TestJsonSendAsync(httpMethod, selfResourceUrl, body);
await testBase.UserClient.TestJsonSendAsync(httpMethod, otherResourceUrl, body, expectedStatusCode: HttpStatusCode.Forbidden);
await testBase.AdminClient.TestJsonSendAsync(httpMethod, selfResourceUrl, body);
}
}
}
|