Implement per-school save functionality by introducing a dedicated save directory and updating the school management system to support loading and saving school states. Revise documentation to reflect these changes, including updates to the architecture and design documents, and enhance the API for reloading schools from disk. Update tests to ensure proper functionality of the new save and reload features.
This commit is contained in:
@@ -145,6 +145,21 @@ public class SchoolApiTests(AppHostFixture fixture)
|
||||
Assert.True(status.Tick > 0, "The loop should have ticked by now.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ReloadFromDisk_RestoresCreatedSchools()
|
||||
{
|
||||
using var client = fixture.App.CreateHttpClient("server");
|
||||
await ResetAsync(client);
|
||||
var created = await CreateAsync(client, "После перезагрузки", ExpectedDefaultStart);
|
||||
|
||||
using var reload = await client.PostAsync("/api/dev/reload-schools", content: null, TestContext.Current.CancellationToken);
|
||||
reload.EnsureSuccessStatusCode();
|
||||
|
||||
var restored = (await GetSchoolsAsync(client)).Schools.Single(school => school.Id == created.Id);
|
||||
Assert.Equal(created.Name, restored.Name);
|
||||
Assert.True(restored.Running);
|
||||
}
|
||||
|
||||
internal static async Task ResetAsync(HttpClient client)
|
||||
{
|
||||
var state = await GetSchoolsAsync(client);
|
||||
|
||||
Reference in New Issue
Block a user