E5: Dashboard e finestra della cartella dicono il vero sulle copie automatiche
«Riprendi» e «Riprendi tutte» restano attivi mentre lavora una copia automatica, che cede il passo (risposta 49): li spegne solo un lavoro di Alberto. «Annulla» di un lavoro automatico dice che i file ripartono da soli; la risposta a «Interrompi» dice l'ora come il resto («all'1:20», «domani alle 0:30»), e «dal» si elide («dall'8 dicembre»). Nella finestra della cartella «Salva» aspetta il conto dei tipi di adesso, un conto non riuscito si richiede e il suo errore resta, il fuoco della tastiera non salta; una nota dice perché «Automatica» è spenta senza cartelle scrivibili. «Riprendi ora» torna attivo se la richiesta fallisce. Il conto dei file che aspettano si condivide fra letture e non si fa per la scheda di un account senza cartella sua; sul telefono i pulsanti della tabella delle cartelle vanno a capo. Prove nuove: chiusura che ferma prima il lavoratore, percorso troppo lungo, attesa di due minuti dall'ultimo file e tetto di un quarto d'ora. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3c48582067
commit
9c7f2f1ad5
16 files changed
+334
-69
No files matched your search
@@ -220,10 +220,15 @@ public sealed partial class ExportApiTests
|
||||
Assert.AreEqual(5, paused.Int("waiting"), paused.ToString());
|
||||
Assert.AreEqual("La cartella non risponde.", paused.Str("problem"));
|
||||
|
||||
// The account card shows the same folder, automatic, with what waits.
|
||||
// The account card shows the same folder, automatic; the files that wait for the general folder are not
|
||||
// counted for it (the card never shows them).
|
||||
var card = (await server.GetJsonAsync($"/api/accounts/{marta.Account.Id}")).GetProperty("export").GetProperty("destination");
|
||||
Assert.IsTrue(card.Bool("automatic"));
|
||||
Assert.AreEqual(5, card.Int("waiting"));
|
||||
Assert.AreEqual(JsonValueKind.Null, card.GetProperty("waiting").ValueKind);
|
||||
|
||||
// Readings that find the count stale together get the same count.
|
||||
var together = await Task.WhenAll(Enumerable.Range(0, 4).Select(_ => server.GetJsonAsync("/api/export")));
|
||||
Assert.IsTrue(together.All(o => o.GetProperty("general").Int("waiting") == 5));
|
||||
|
||||
// A folder without «Automatica», in pause: what its unfinished jobs still have to copy.
|
||||
var (ownStatus, ownSaved) = await server.SendJsonAsync(HttpMethod.Post, "/api/export/destinations", Destination(nas, scope: "account", accountId: luca.Account.Id));
|
||||
@@ -240,6 +245,8 @@ public sealed partial class ExportApiTests
|
||||
Assert.AreEqual(2, ownDto.Int("waiting"), ownDto.ToString());
|
||||
Assert.AreEqual(JsonValueKind.Null, ownDto.GetProperty("automaticSince").ValueKind);
|
||||
Assert.AreEqual(3, overview.GetProperty("general").Int("waiting"), "luca's files now go to his own folder");
|
||||
var lucaCard = (await server.GetJsonAsync($"/api/accounts/{luca.Account.Id}")).GetProperty("export").GetProperty("destination");
|
||||
Assert.AreEqual(2, lucaCard.Int("waiting"), "the own folder of the card is counted");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -271,7 +278,7 @@ public sealed partial class ExportApiTests
|
||||
var session = new FakeSessionState();
|
||||
var clock = new GatedClock(new ManualClock(Make.T0));
|
||||
await using var server = await StartAsync(session: session, clock: clock);
|
||||
await AddPhotosAsync(server, "marta.demo", 2);
|
||||
var marta = await AddPhotosAsync(server, "marta.demo", 2);
|
||||
var usb = server.Temp.Combine("usb");
|
||||
Directory.CreateDirectory(usb);
|
||||
var (created, saved) = await server.SendJsonAsync(HttpMethod.Post, "/api/export/destinations", Destination(usb, automatic: true, onlyNew: false));
|
||||
@@ -294,13 +301,14 @@ public sealed partial class ExportApiTests
|
||||
})).GetValueOrDefault();
|
||||
Assert.AreEqual("automatic", progress.Str("origin"));
|
||||
Assert.AreEqual("copy", progress.Str("kind"));
|
||||
Assert.IsFalse(progress.Bool("manualRunning"), "an automatic copy keeps no «Riprendi» off (answer 49)");
|
||||
|
||||
// «Interrompi» (answer 53): the automatic copies stop until the next round, at least an hour, and the answer says when.
|
||||
var (status, answer) = await server.SendJsonAsync(HttpMethod.Post, "/api/export/interrupt");
|
||||
Assert.AreEqual(HttpStatusCode.OK, status, answer.ToString());
|
||||
var until = clock.Now + service.AutomaticHoldTime;
|
||||
Assert.AreEqual(until, service.AutomaticHeldUntil);
|
||||
Assert.AreEqual(ExportText.AutomaticInterrupted(until, clock.LocalZone), answer.Str("message"));
|
||||
Assert.AreEqual(ExportText.AutomaticInterrupted(until, clock.Now, clock.LocalZone), answer.Str("message"));
|
||||
StringAssert.Contains(answer.Str("message"), "riprende da sola alle");
|
||||
Assert.AreEqual(ExportRunState.Interrupted, (await server.Db.Exports.GetRunAsync(start.Runs[0].Id))!.State);
|
||||
|
||||
@@ -310,10 +318,25 @@ public sealed partial class ExportApiTests
|
||||
Assert.AreEqual("Copie automatiche di nuovo attive.", resumeAnswer.Str("message"));
|
||||
Assert.IsNull(service.AutomaticHeldUntil);
|
||||
|
||||
// A manual job keeps the message of before.
|
||||
session.InSession = false;
|
||||
// A job of Alberto's, waiting for the session: it is the one that keeps «Riprendi» off; «Interrompi» keeps the
|
||||
// message of before.
|
||||
service.AutomaticRunRecorded = null;
|
||||
var (manualStatus, manualJob) = await server.SendJsonAsync(HttpMethod.Post, "/api/export/start", new { accountId = marta.Account.Id, copyAgain = true });
|
||||
Assert.AreEqual(HttpStatusCode.OK, manualStatus, manualJob.ToString());
|
||||
var manualProgress = (await WaitForAsync(async () =>
|
||||
{
|
||||
var p = await server.GetJsonAsync("/api/export/progress");
|
||||
return p.Bool("running") && p.Str("phase") == "waitingForSession" && p.Str("origin") == "manual" ? (JsonElement?)p : null;
|
||||
})).GetValueOrDefault();
|
||||
Assert.IsTrue(manualProgress.Bool("manualRunning"));
|
||||
Assert.AreEqual("Interrotta: quello che è stato copiato resta, e riprendi da qui quando vuoi.", (await server.SendJsonAsync(HttpMethod.Post, "/api/export/interrupt")).Body.Str("message"));
|
||||
Assert.IsNull(service.AutomaticHeldUntil);
|
||||
session.InSession = false;
|
||||
|
||||
// «Annulla» of the automatic job says that its files go back into the queue (D12).
|
||||
var (discarded, discardAnswer) = await server.SendJsonAsync(HttpMethod.Post, $"/api/export/runs/{start.Runs[0].Id}/discard");
|
||||
Assert.AreEqual(HttpStatusCode.OK, discarded, discardAnswer.ToString());
|
||||
Assert.AreEqual(ExportText.DiscardedAutomatic, discardAnswer.Str("message"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
Reference in new issue
Block a user