From c1586e28e44835b3636fb63e31f613de4a30bc1e Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Sun, 4 Aug 2019 14:47:17 +0800 Subject: Clean codes. --- .../Helpers/Authentication/AuthenticationExtensions.cs | 12 ------------ Timeline.Tests/Helpers/TestUsers.cs | 4 ++-- Timeline.Tests/Helpers/UserInfoComparers.cs | 2 -- 3 files changed, 2 insertions(+), 16 deletions(-) (limited to 'Timeline.Tests/Helpers') diff --git a/Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs b/Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs index f4e2e45a..03fb9714 100644 --- a/Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs +++ b/Timeline.Tests/Helpers/Authentication/AuthenticationExtensions.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Mvc.Testing; using Newtonsoft.Json; -using System; using System.Net.Http; using System.Threading.Tasks; using Timeline.Entities.Http; @@ -25,16 +24,5 @@ namespace Timeline.Tests.Helpers.Authentication client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); return client; } - - public static async Task SendWithAuthenticationAsync(this HttpClient client, string token, string path, Action requestBuilder = null) - { - var request = new HttpRequestMessage - { - RequestUri = new Uri(client.BaseAddress, path), - }; - request.Headers.Add("Authorization", "Bearer " + token); - requestBuilder?.Invoke(request); - return await client.SendAsync(request); - } } } diff --git a/Timeline.Tests/Helpers/TestUsers.cs b/Timeline.Tests/Helpers/TestUsers.cs index 60ea5e27..41dd83a9 100644 --- a/Timeline.Tests/Helpers/TestUsers.cs +++ b/Timeline.Tests/Helpers/TestUsers.cs @@ -17,14 +17,14 @@ namespace Timeline.Tests.Helpers { Name = "user", EncryptedPassword = passwordService.HashPassword("user"), - RoleString = "user", + RoleString = UserUtility.IsAdminToRoleString(false), Version = 0, }); mockUsers.Add(new User { Name = "admin", EncryptedPassword = passwordService.HashPassword("admin"), - RoleString = "user,admin", + RoleString = UserUtility.IsAdminToRoleString(true), Version = 0, }); diff --git a/Timeline.Tests/Helpers/UserInfoComparers.cs b/Timeline.Tests/Helpers/UserInfoComparers.cs index 0d91efe3..fcf37e5c 100644 --- a/Timeline.Tests/Helpers/UserInfoComparers.cs +++ b/Timeline.Tests/Helpers/UserInfoComparers.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; using Timeline.Entities; namespace Timeline.Tests.Helpers -- cgit v1.2.3