oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package team
2
3import (
4 "encoding/json"
5 "testing"
6)
7
8func TestTrialEvidenceAndPublication(t *testing.T) {
9 g := newGitEnv(t)
10 g.observed.Isolation.Trial = &TrialSnapshot{Label: "supervised trial", AcknowledgementIDs: []string{"trial-1"}, UnverifiedChecks: TrialChecks(), ProviderVersionSource: "observed_locally"}
11 g.build()
12 g.review()
13 g.verify(true)
14 if g.artifact.Provenance.Isolation.Trial == nil {
15 t.Fatal("candidate missing trial")
16 }
17 h := g.claimStep("publish")
18 p, err := g.store.Publication(g.ctx, g.scope, h)
19 must(t, err)
20 var d PublicationDescription
21 must(t, json.Unmarshal([]byte(p.Description), &d))
22 if d.Isolation.Trial == nil || d.Isolation.Trial.Label != "supervised trial" || d.Label != "unconfined" {
23 t.Fatal("publication missing labels")
24 }
25 for _, e := range d.Evidence {
26 if e.Provenance.Isolation.Trial == nil || e.Label != "unconfined" {
27 t.Fatal("evidence missing labels", e.Role)
28 }
29 }
30 stripped := d
31 stripped.Isolation.Trial = nil
32 if publicationDescriptionContains(string(mustJSON(stripped)), p.Description) {
33 t.Fatal("description accepted stripped trial")
34 }
35 stripped = d
36 stripped.Evidence = append([]PublicationEvidence(nil), d.Evidence...)
37 stripped.Evidence[0].Provenance.Isolation.Trial = nil
38 if publicationDescriptionContains(string(mustJSON(stripped)), p.Description) {
39 t.Fatal("evidence accepted stripped trial")
40 }
41}
42