Don't use online API for tests

This commit is contained in:
Andrei Zavatski 2019-11-06 18:24:30 +03:00
parent c01f3a58cb
commit 8395df596b
1 changed files with 4 additions and 11 deletions

View File

@ -6,11 +6,9 @@
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Overlays.Comments;
using osu.Framework.Allocation;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users;
using osu.Framework.MathUtils;
using osu.Game.Online.API;
namespace osu.Game.Tests.Visual.Online
{
@ -22,17 +20,12 @@ public class TestSceneVotePill : OsuTestScene
typeof(VotePill)
};
protected override bool UseOnlineAPI => true;
[Resolved]
private IAPIProvider api { get; set; }
private VotePill votePill;
[Test]
public void TestUserCommentPill()
{
AddStep("Log in", () => api.LocalUser.Value = new User
AddStep("Log in", () => API.LocalUser.Value = new User
{
Id = RNG.Next(2, 100000)
});
@ -44,7 +37,7 @@ public void TestUserCommentPill()
[Test]
public void TestRandomCommentPill()
{
AddStep("Log in", () => api.LocalUser.Value = new User
AddStep("Log in", () => API.LocalUser.Value = new User
{
Id = RNG.Next(2, 100000)
});
@ -56,7 +49,7 @@ public void TestRandomCommentPill()
[Test]
public void TestOfflineRandomCommentPill()
{
AddStep("Log out", api.Logout);
AddStep("Log out", API.Logout);
AddStep("Random comment", () => addVotePill(getRandomComment()));
AddStep("Click", () => votePill.Click());
AddAssert("Not loading", () => !votePill.IsLoading);
@ -65,7 +58,7 @@ public void TestOfflineRandomCommentPill()
private Comment getUserComment() => new Comment
{
IsVoted = false,
UserId = api.LocalUser.Value.Id,
UserId = API.LocalUser.Value.Id,
VotesCount = 10,
};