diff options
author | crupest <crupest@outlook.com> | 2020-11-15 01:44:48 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-11-15 01:44:48 +0800 |
commit | f5ccd0d9855f82e14c6b765eee6a04b22c50dc8a (patch) | |
tree | 5dc8da01f7a01e86bcacf85ac449b24ce4fac3a5 /BackEnd/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs | |
parent | c6ff19254382ff68f63cb06f39c65e7c8aaa89d7 (diff) | |
download | timeline-f5ccd0d9855f82e14c6b765eee6a04b22c50dc8a.tar.gz timeline-f5ccd0d9855f82e14c6b765eee6a04b22c50dc8a.tar.bz2 timeline-f5ccd0d9855f82e14c6b765eee6a04b22c50dc8a.zip |
...
Diffstat (limited to 'BackEnd/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs')
-rw-r--r-- | BackEnd/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs b/BackEnd/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs index 070b456f..72480dc6 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs @@ -104,10 +104,9 @@ namespace Timeline.Tests.IntegratedTests public async Task<HttpClient> CreateClientWithCredential(string username, string password, bool setApiBase = true)
{
var client = await CreateDefaultClient(setApiBase);
- var response = await client.PostAsJsonAsync("token/create",
+ var res = await client.TestPostAsync<CreateTokenResponse>("token/create",
new CreateTokenRequest { Username = username, Password = password });
- var token = (await response.Should().HaveStatusCode(200)
- .And.HaveAndGetJsonBodyAsync<CreateTokenResponse>()).Token;
+ var token = res.Token;
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
return client;
}
|