aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/Authentication/AuthenticationHttpClientExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Timeline.Tests/Helpers/Authentication/AuthenticationHttpClientExtensions.cs')
-rw-r--r--Timeline.Tests/Helpers/Authentication/AuthenticationHttpClientExtensions.cs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Timeline.Tests/Helpers/Authentication/AuthenticationHttpClientExtensions.cs b/Timeline.Tests/Helpers/Authentication/AuthenticationHttpClientExtensions.cs
index a4cb8c65..ccb2a372 100644
--- a/Timeline.Tests/Helpers/Authentication/AuthenticationHttpClientExtensions.cs
+++ b/Timeline.Tests/Helpers/Authentication/AuthenticationHttpClientExtensions.cs
@@ -1,11 +1,9 @@
using Newtonsoft.Json;
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
-using Timeline.Controllers;
+using Timeline.Entities;
using Xunit;
namespace Timeline.Tests.Helpers.Authentication
@@ -14,13 +12,16 @@ namespace Timeline.Tests.Helpers.Authentication
{
private const string CreateTokenUrl = "/api/User/CreateToken";
- public static async Task<UserController.CreateTokenResult> CreateUserTokenAsync(this HttpClient client, string username, string password)
+ public static async Task<CreateTokenResponse> CreateUserTokenAsync(this HttpClient client, string username, string password, bool assertSuccess = true)
{
- var response = await client.PostAsJsonAsync(CreateTokenUrl, new UserController.UserCredentials { Username = username, Password = password });
+ var response = await client.PostAsJsonAsync(CreateTokenUrl, new CreateTokenRequest { Username = username, Password = password });
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- var result = JsonConvert.DeserializeObject<UserController.CreateTokenResult>(await response.Content.ReadAsStringAsync());
+ var result = JsonConvert.DeserializeObject<CreateTokenResponse>(await response.Content.ReadAsStringAsync());
+
+ if (assertSuccess)
+ Assert.True(result.Success);
return result;
}