Require suggestion before entering vote phase
This commit is contained in:
@@ -15,13 +15,13 @@ public class AdminTests
|
||||
await using var factory = new TestWebApplicationFactory();
|
||||
var admin = factory.CreateClientWithCookies();
|
||||
await admin.RegisterAsync("admin", admin: true);
|
||||
await admin.PostAsJsonAsync("/api/me/phase/next", new { }); // move to Vote
|
||||
await admin.AdvanceToVoteAsync("Admin seed"); // move to Vote
|
||||
|
||||
var p1 = factory.CreateClientWithCookies();
|
||||
await p1.RegisterAsync("alice");
|
||||
var p2 = factory.CreateClientWithCookies();
|
||||
await p2.RegisterAsync("bob");
|
||||
await p2.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await p2.AdvanceToVoteAsync("Bob seed");
|
||||
|
||||
var s1 = await p1.CreateSuggestionAsync("A");
|
||||
await p1.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
@@ -111,7 +111,7 @@ public class AdminTests
|
||||
var b = await player.CreateSuggestionAsync("Game B");
|
||||
|
||||
await player.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await admin.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await admin.AdvanceToVoteAsync("Admin link seed");
|
||||
|
||||
var same = await admin.PostAsJsonAsync("/api/admin/link-suggestions", new
|
||||
{
|
||||
@@ -147,7 +147,7 @@ public class AdminTests
|
||||
var a = await player.CreateSuggestionAsync("Game A");
|
||||
var b = await player.CreateSuggestionAsync("Game B");
|
||||
await player.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await admin.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await admin.AdvanceToVoteAsync("Admin unlink seed");
|
||||
await admin.PostAsJsonAsync("/api/admin/link-suggestions", new
|
||||
{
|
||||
SourceSuggestionId = a,
|
||||
@@ -269,7 +269,7 @@ public class AdminTests
|
||||
await using var factory = new TestWebApplicationFactory();
|
||||
var admin = factory.CreateClientWithCookies();
|
||||
await admin.RegisterAsync("admin", admin: true);
|
||||
await admin.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await admin.AdvanceToVoteAsync("Admin vote status seed");
|
||||
|
||||
var p1 = factory.CreateClientWithCookies();
|
||||
await p1.RegisterAsync("alice");
|
||||
@@ -277,7 +277,7 @@ public class AdminTests
|
||||
await p2.RegisterAsync("bob");
|
||||
var s = await p1.CreateSuggestionAsync("Game");
|
||||
await p1.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await p2.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await p2.AdvanceToVoteAsync("Bob vote seed");
|
||||
await p1.PostAsJsonAsync("/api/votes", new
|
||||
{
|
||||
SuggestionId = s,
|
||||
@@ -300,7 +300,7 @@ public class AdminTests
|
||||
|
||||
var p = factory.CreateClientWithCookies();
|
||||
await p.RegisterAsync("player");
|
||||
await p.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await p.AdvanceToVoteAsync("Player joker seed");
|
||||
await p.PostAsJsonAsync("/api/votes/finalize", new { Final = true });
|
||||
|
||||
var give = await admin.PostAsJsonAsync("/api/admin/joker", new { playerId = (await p.GetProfileIdAsync()) });
|
||||
@@ -333,7 +333,7 @@ public class AdminTests
|
||||
});
|
||||
Assert.Equal(HttpStatusCode.BadRequest, beforeVotePhase.StatusCode);
|
||||
|
||||
await admin.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await admin.AdvanceToVoteAsync("Admin link-phase seed");
|
||||
await player.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
|
||||
await player.PostAsJsonAsync("/api/votes", new
|
||||
@@ -373,9 +373,9 @@ public class AdminTests
|
||||
var a = await p1.CreateSuggestionAsync("A");
|
||||
var b = await p1.CreateSuggestionAsync("B");
|
||||
|
||||
await admin.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await admin.AdvanceToVoteAsync("Admin unfinalize seed");
|
||||
await p1.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await p2.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await p2.AdvanceToVoteAsync("P2 unfinalize seed");
|
||||
|
||||
await p1.PostAsJsonAsync("/api/votes/finalize", new { Final = true });
|
||||
await p2.PostAsJsonAsync("/api/votes/finalize", new { Final = true });
|
||||
@@ -400,7 +400,7 @@ public class AdminTests
|
||||
await using var factory = new TestWebApplicationFactory();
|
||||
var admin = factory.CreateClientWithCookies();
|
||||
await admin.RegisterAsync("admin", admin: true);
|
||||
await admin.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await admin.AdvanceToVoteAsync("Admin unlink not-found seed");
|
||||
|
||||
var resp = await admin.PostAsJsonAsync("/api/admin/unlink-suggestions", new { suggestionId = 9999 });
|
||||
resp.EnsureSuccessStatusCode();
|
||||
|
||||
Reference in New Issue
Block a user