diff options
author | 杨宇千 <crupest@outlook.com> | 2019-10-24 20:15:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-24 20:15:58 +0800 |
commit | 7305358a88ffc87f51f7b78deb4f07ef99120beb (patch) | |
tree | 7ca5010a06829cc5fadea1ea17ae72d082fc344c /Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs | |
parent | 297d0c9029360f1d5334ed843b9b299356740ec1 (diff) | |
parent | a0f3cd7599a48c14fb5492fb1c6e2dbd0a82fb45 (diff) | |
download | timeline-7305358a88ffc87f51f7b78deb4f07ef99120beb.tar.gz timeline-7305358a88ffc87f51f7b78deb4f07ef99120beb.tar.bz2 timeline-7305358a88ffc87f51f7b78deb4f07ef99120beb.zip |
Merge pull request #50 from crupest/refactor
Refactor : A Huge Step
Diffstat (limited to 'Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs')
-rw-r--r-- | Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs b/Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs index c8a79e58..34d7e460 100644 --- a/Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs +++ b/Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs @@ -13,8 +13,8 @@ namespace Timeline.Tests.Helpers.Authentication public static async Task<CreateTokenResponse> CreateUserTokenAsync(this HttpClient client, string username, string password, int? expireOffset = null)
{
- var response = await client.PostAsJsonAsync(CreateTokenUrl, new CreateTokenRequest { Username = username, Password = password, ExpireOffset = expireOffset });
- response.Should().HaveStatusCodeOk();
+ var response = await client.PostAsJsonAsync(CreateTokenUrl, new CreateTokenRequest { Username = username, Password = password, Expire = expireOffset });
+ response.Should().HaveStatusCode(200);
var result = JsonConvert.DeserializeObject<CreateTokenResponse>(await response.Content.ReadAsStringAsync());
return result;
}
@@ -29,12 +29,12 @@ namespace Timeline.Tests.Helpers.Authentication public static Task<HttpClient> CreateClientAsUser<T>(this WebApplicationFactory<T> factory) where T : class
{
- return factory.CreateClientWithCredential(MockUsers.UserUsername, MockUsers.UserPassword);
+ return factory.CreateClientWithCredential(MockUser.User.Username, MockUser.User.Password);
}
public static Task<HttpClient> CreateClientAsAdmin<T>(this WebApplicationFactory<T> factory) where T : class
{
- return factory.CreateClientWithCredential(MockUsers.AdminUsername, MockUsers.AdminPassword);
+ return factory.CreateClientWithCredential(MockUser.Admin.Username, MockUser.Admin.Password);
}
}
}
|