aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/IntegratedTests/UserTest.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-01-19 22:45:43 +0800
committercrupest <crupest@outlook.com>2020-01-19 22:45:43 +0800
commite6069a6980ec6d2505e19026d4c84a9588f153dc (patch)
tree1fa3969a53138becb76a7eef7bafdafc7046c12c /Timeline.Tests/IntegratedTests/UserTest.cs
parentc5f3c69b3a008ab87542e523e2a59f37801bd65a (diff)
downloadtimeline-e6069a6980ec6d2505e19026d4c84a9588f153dc.tar.gz
timeline-e6069a6980ec6d2505e19026d4c84a9588f153dc.tar.bz2
timeline-e6069a6980ec6d2505e19026d4c84a9588f153dc.zip
Basically finish refactor of error codes.
Diffstat (limited to 'Timeline.Tests/IntegratedTests/UserTest.cs')
-rw-r--r--Timeline.Tests/IntegratedTests/UserTest.cs11
1 files changed, 5 insertions, 6 deletions
diff --git a/Timeline.Tests/IntegratedTests/UserTest.cs b/Timeline.Tests/IntegratedTests/UserTest.cs
index abfea18e..fbef6da3 100644
--- a/Timeline.Tests/IntegratedTests/UserTest.cs
+++ b/Timeline.Tests/IntegratedTests/UserTest.cs
@@ -7,7 +7,6 @@ using Timeline.Models;
using Timeline.Models.Http;
using Timeline.Tests.Helpers;
using Xunit;
-using static Timeline.ErrorCodes.Http.User;
namespace Timeline.Tests.IntegratedTests
{
@@ -54,7 +53,7 @@ namespace Timeline.Tests.IntegratedTests
var res = await client.GetAsync("users/usernotexist");
res.Should().HaveStatusCode(404)
.And.HaveCommonBody()
- .Which.Code.Should().Be(Get.NotExist);
+ .Which.Code.Should().Be(ErrorCodes.UserCommon.NotExist);
}
public static IEnumerable<object[]> Put_InvalidModel_Data()
@@ -118,7 +117,7 @@ namespace Timeline.Tests.IntegratedTests
var res = await client.PatchAsJsonAsync("users/usernotexist", new UserPatchRequest { });
res.Should().HaveStatusCode(404)
.And.HaveCommonBody()
- .Which.Code.Should().Be(Patch.NotExist);
+ .Which.Code.Should().Be(ErrorCodes.UserCommon.NotExist);
}
[Fact]
@@ -198,7 +197,7 @@ namespace Timeline.Tests.IntegratedTests
new ChangeUsernameRequest { OldUsername = "usernotexist", NewUsername = "newUsername" });
res.Should().HaveStatusCode(400)
.And.HaveCommonBody()
- .Which.Code.Should().Be(Op.ChangeUsername.NotExist);
+ .Which.Code.Should().Be(ErrorCodes.UserCommon.NotExist);
}
[Fact]
@@ -209,7 +208,7 @@ namespace Timeline.Tests.IntegratedTests
new ChangeUsernameRequest { OldUsername = MockUser.User.Username, NewUsername = MockUser.Admin.Username });
res.Should().HaveStatusCode(400)
.And.HaveCommonBody()
- .Which.Code.Should().Be(Op.ChangeUsername.AlreadyExist);
+ .Which.Code.Should().Be(ErrorCodes.UserController.ChangeUsername_Conflict);
}
private async Task TestLogin(string username, string password)
@@ -256,7 +255,7 @@ namespace Timeline.Tests.IntegratedTests
var res = await client.PostAsJsonAsync(changePasswordUrl, new ChangePasswordRequest { OldPassword = "???", NewPassword = "???" });
res.Should().HaveStatusCode(400)
.And.HaveCommonBody()
- .Which.Code.Should().Be(Op.ChangePassword.BadOldPassword);
+ .Which.Code.Should().Be(ErrorCodes.UserController.ChangePassword_BadOldPassword);
}
[Fact]