Combine a bunch of helpers together, shuffle some things around

This commit is contained in:
jvyden 2022-05-15 00:24:22 -04:00
commit 330c01317d
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
61 changed files with 327 additions and 371 deletions

View file

@ -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");

View file

@ -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);