mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-25 03:36:51 +00:00
Combine a bunch of helpers together, shuffle some things around
This commit is contained in:
parent
71a97894ad
commit
330c01317d
61 changed files with 327 additions and 371 deletions
|
@ -19,7 +19,7 @@ public class AuthenticationTests : LighthouseWebTest
|
|||
await using Database database = new();
|
||||
Random random = new();
|
||||
|
||||
string password = CryptoHelper.Sha256Hash(RandomHelper.GenerateRandomBytes(64).ToArray());
|
||||
string password = CryptoHelper.Sha256Hash(CryptoHelper.GenerateRandomBytes(64).ToArray());
|
||||
User user = await database.CreateUser($"unitTestUser{random.Next()}", CryptoHelper.BCryptHash(CryptoHelper.Sha256Hash(password)));
|
||||
|
||||
this.Driver.Navigate().GoToUrl(this.BaseAddress + "/login");
|
||||
|
|
|
@ -19,7 +19,7 @@ public class RegisterTests : LighthouseWebTest
|
|||
await using Database database = new();
|
||||
|
||||
string username = ("unitTestUser" + new Random().Next()).Substring(0, 16);
|
||||
string password = CryptoHelper.Sha256Hash(RandomHelper.GenerateRandomBytes(64).ToArray());
|
||||
string password = CryptoHelper.Sha256Hash(CryptoHelper.GenerateRandomBytes(64).ToArray());
|
||||
|
||||
this.Driver.Navigate().GoToUrl(this.BaseAddress + "/register");
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class RegisterTests : LighthouseWebTest
|
|||
await using Database database = new();
|
||||
|
||||
string username = ("unitTestUser" + new Random().Next()).Substring(0, 16);
|
||||
string password = CryptoHelper.Sha256Hash(RandomHelper.GenerateRandomBytes(64).ToArray());
|
||||
string password = CryptoHelper.Sha256Hash(CryptoHelper.GenerateRandomBytes(64).ToArray());
|
||||
|
||||
this.Driver.Navigate().GoToUrl(this.BaseAddress + "/register");
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class RegisterTests : LighthouseWebTest
|
|||
await using Database database = new();
|
||||
|
||||
string username = ("unitTestUser" + new Random().Next()).Substring(0, 16);
|
||||
string password = CryptoHelper.Sha256Hash(RandomHelper.GenerateRandomBytes(64).ToArray());
|
||||
string password = CryptoHelper.Sha256Hash(CryptoHelper.GenerateRandomBytes(64).ToArray());
|
||||
|
||||
await database.CreateUser(username, CryptoHelper.BCryptHash(password));
|
||||
User? user = await database.Users.FirstOrDefaultAsync(u => u.Username == username);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue