diff options
author | crupest <crupest@outlook.com> | 2020-11-12 21:38:43 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-11-12 21:38:43 +0800 |
commit | e4c4a284571d51dcda373a0a1c047e634b17882d (patch) | |
tree | 2343fba4753576fd33a79e2f2d4fe1484e11f557 /BackEnd/Timeline.Tests/IntegratedTests | |
parent | b81a66ff49f5d9305108e92a009449ee5994862e (diff) | |
download | timeline-e4c4a284571d51dcda373a0a1c047e634b17882d.tar.gz timeline-e4c4a284571d51dcda373a0a1c047e634b17882d.tar.bz2 timeline-e4c4a284571d51dcda373a0a1c047e634b17882d.zip |
...
Diffstat (limited to 'BackEnd/Timeline.Tests/IntegratedTests')
-rw-r--r-- | BackEnd/Timeline.Tests/IntegratedTests/AuthorizationTest.cs | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/AuthorizationTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/AuthorizationTest.cs deleted file mode 100644 index 38071394..00000000 --- a/BackEnd/Timeline.Tests/IntegratedTests/AuthorizationTest.cs +++ /dev/null @@ -1,52 +0,0 @@ -using FluentAssertions;
-using System.Net;
-using System.Threading.Tasks;
-using Timeline.Tests.Helpers;
-using Xunit;
-
-namespace Timeline.Tests.IntegratedTests
-{
- public class AuthorizationTest : IntegratedTestBase
- {
- private const string BaseUrl = "testing/auth/";
- private const string AuthorizeUrl = BaseUrl + "Authorize";
- private const string UserUrl = BaseUrl + "User";
- private const string AdminUrl = BaseUrl + "Admin";
-
- [Fact]
- public async Task UnauthenticationTest()
- {
- using var client = await CreateDefaultClient();
- var response = await client.GetAsync(AuthorizeUrl);
- response.Should().HaveStatusCode(HttpStatusCode.Unauthorized);
- }
-
- [Fact]
- public async Task AuthenticationTest()
- {
- using var client = await CreateClientAsUser();
- var response = await client.GetAsync(AuthorizeUrl);
- response.Should().HaveStatusCode(HttpStatusCode.OK);
- }
-
- [Fact]
- public async Task UserAuthorizationTest()
- {
- using var client = await CreateClientAsUser();
- var response1 = await client.GetAsync(UserUrl);
- response1.Should().HaveStatusCode(HttpStatusCode.OK);
- var response2 = await client.GetAsync(AdminUrl);
- response2.Should().HaveStatusCode(HttpStatusCode.Forbidden);
- }
-
- [Fact]
- public async Task AdminAuthorizationTest()
- {
- using var client = await CreateClientAsAdministrator();
- var response1 = await client.GetAsync(UserUrl);
- response1.Should().HaveStatusCode(HttpStatusCode.OK);
- var response2 = await client.GetAsync(AdminUrl);
- response2.Should().HaveStatusCode(HttpStatusCode.OK);
- }
- }
-}
|