mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-11 06:18:39 +00:00
Massive organization of classes and namespaces
This commit is contained in:
parent
3e7a5910cd
commit
c345eeebb9
218 changed files with 468 additions and 342 deletions
69
ProjectLighthouse.Tests.GameApiTests/Tests/UploadTests.cs
Normal file
69
ProjectLighthouse.Tests.GameApiTests/Tests/UploadTests.cs
Normal file
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData;
|
||||
using LBPUnion.ProjectLighthouse.Tests;
|
||||
using Xunit;
|
||||
|
||||
namespace ProjectLighthouse.Tests.GameApiTests.Tests;
|
||||
|
||||
public class UploadTests : LighthouseServerTest
|
||||
{
|
||||
public UploadTests()
|
||||
{
|
||||
string assetsDirectory = Path.Combine(Environment.CurrentDirectory, "r");
|
||||
if (Directory.Exists(assetsDirectory)) Directory.Delete(assetsDirectory, true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ShouldNotAcceptScript()
|
||||
{
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
|
||||
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestScript.ff", loginResult.AuthTicket);
|
||||
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ShouldNotAcceptFarc()
|
||||
{
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
|
||||
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestFarc.farc", loginResult.AuthTicket);
|
||||
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ShouldNotAcceptGarbage()
|
||||
{
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
|
||||
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestGarbage.bin", loginResult.AuthTicket);
|
||||
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ShouldAcceptTexture()
|
||||
{
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
|
||||
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestTexture.tex", loginResult.AuthTicket);
|
||||
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
|
||||
Assert.True(response.IsSuccessStatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ShouldAcceptLevel()
|
||||
{
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
|
||||
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestLevel.lvl", loginResult.AuthTicket);
|
||||
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
|
||||
Assert.True(response.IsSuccessStatusCode);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue