mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-12 14:58:42 +00:00
Fix tests
This commit is contained in:
parent
e4f764784e
commit
24b712cd15
4 changed files with 31 additions and 7 deletions
|
@ -47,7 +47,7 @@ namespace LBPUnion.ProjectLighthouse.Tests {
|
|||
string responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
Assert.True(response.IsSuccessStatusCode);
|
||||
Assert.Contains("You are logged in", responseContent);
|
||||
Assert.Contains("You are now logged in", responseContent);
|
||||
}
|
||||
|
||||
[DatabaseFact]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
|
@ -10,11 +11,27 @@ namespace LBPUnion.ProjectLighthouse.Tests {
|
|||
private static readonly SemaphoreSlim semaphore = new(1, 1);
|
||||
|
||||
[DatabaseFact]
|
||||
public async Task ShouldReturnOk() {
|
||||
public async Task ShouldRejectEmptyData() {
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
await semaphore.WaitAsync();
|
||||
|
||||
HttpResponseMessage result = await this.AuthenticatedUploadDataRequest("LITTLEBIGPLANETPS3_XML/match", Array.Empty<byte>(), loginResult.AuthTicket);
|
||||
Assert.False(result.IsSuccessStatusCode);
|
||||
|
||||
semaphore.Release();
|
||||
}
|
||||
|
||||
[DatabaseFact]
|
||||
public async Task ShouldReturnOk() {
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
await semaphore.WaitAsync();
|
||||
|
||||
HttpResponseMessage result = await this.AuthenticatedUploadDataRequest(
|
||||
"LITTLEBIGPLANETPS3_XML/match",
|
||||
Encoding.ASCII.GetBytes("[UpdateMyPlayerData,[\"Player\":\"1984\"]]"),
|
||||
loginResult.AuthTicket
|
||||
);
|
||||
|
||||
Assert.True(result.IsSuccessStatusCode);
|
||||
|
||||
semaphore.Release();
|
||||
|
@ -29,7 +46,12 @@ namespace LBPUnion.ProjectLighthouse.Tests {
|
|||
|
||||
int oldPlayerCount = await this.GetPlayerCount();
|
||||
|
||||
HttpResponseMessage result = await this.AuthenticatedUploadDataRequest("LITTLEBIGPLANETPS3_XML/match", Array.Empty<byte>(), loginResult.AuthTicket);
|
||||
HttpResponseMessage result = await this.AuthenticatedUploadDataRequest(
|
||||
"LITTLEBIGPLANETPS3_XML/match",
|
||||
Encoding.ASCII.GetBytes("[UpdateMyPlayerData,[\"Player\":\"1984\"]]"),
|
||||
loginResult.AuthTicket
|
||||
);
|
||||
|
||||
Assert.True(result.IsSuccessStatusCode);
|
||||
|
||||
int playerCount = await this.GetPlayerCount();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue