Skip to content

Commit

Permalink
Resolve review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Beyley committed Oct 19, 2023
1 parent 0c6f20f commit ebf9262
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
5 changes: 0 additions & 5 deletions RefreshTests.GameServer/TestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ public HttpClient GetAuthenticatedClient(TokenType type, out string tokenData,
return client;
}

public HttpClient GetUnauthenticatedClient()
{
return this.Listener.GetClient();
}

public GameUser CreateUser(string? username = null)
{
username ??= this.UserIncrement.ToString();
Expand Down
14 changes: 7 additions & 7 deletions RefreshTests.GameServer/Tests/Levels/LevelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,21 @@ public void SlotsHeartedQuirkFailsWhenInvalidUser()
public void SlotsMostHearted()
{
using TestContext context = this.GetServer();
GameUser user = context.CreateUser();
GameUser user1 = context.CreateUser();
GameUser user2 = context.CreateUser();
GameUser user3 = context.CreateUser();
GameLevel level = context.CreateLevel(user);
GameLevel level2 = context.CreateLevel(user);
GameLevel level = context.CreateLevel(user1);
GameLevel level2 = context.CreateLevel(user1);

using HttpClient client = context.GetAuthenticatedClient(TokenType.Game, user);
using HttpClient client = context.GetAuthenticatedClient(TokenType.Game, user1);

HttpResponseMessage message = client.GetAsync($"/lbp/slots/mostHearted").Result;
Assert.That(message.StatusCode, Is.EqualTo(OK));

SerializedMinimalLevelList result = message.Content.ReadAsXML<SerializedMinimalLevelList>();
Assert.That(result.Items, Has.Count.EqualTo(0));

context.Database.FavouriteLevel(level, user);
context.Database.FavouriteLevel(level, user1);
context.Database.FavouriteLevel(level, user2);
context.Database.FavouriteLevel(level2, user2);

Expand All @@ -215,7 +215,7 @@ public void SlotsMostHearted()
Assert.That(result.Items[0].LevelId, Is.EqualTo(level.LevelId));
Assert.That(result.Items[1].LevelId, Is.EqualTo(level2.LevelId));

context.Database.FavouriteLevel(level2, user);
context.Database.FavouriteLevel(level2, user1);
context.Database.FavouriteLevel(level2, user3);

message = client.GetAsync($"/lbp/slots/mostHearted").Result;
Expand Down Expand Up @@ -536,7 +536,7 @@ public void SlotsHeartedApiV3FailsWhenNoUser()
GameUser user = context.CreateUser();
GameLevel level = context.CreateLevel(user);

using HttpClient client = context.GetUnauthenticatedClient();
using HttpClient client = context.Http;

HttpResponseMessage message = client.GetAsync($"/api/v3/levels/hearted").Result;
Assert.That(message.StatusCode, Is.EqualTo(NotFound));
Expand Down

0 comments on commit ebf9262

Please sign in to comment.