Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
Go
1234567891011121314151617181920212223242526272829303132333435package models
import ( "testing"
"tangled.org/core/api/tangled")
func TestTrustedPipelineSourceRequiresConsistentCheckoutMetadata(t *testing.T) { target := "did:web:target.example" fork := "did:web:fork.example" for _, tc := range []struct { name string repo *string source *string trusted bool }{ {name: "target checkout", repo: &target, trusted: true}, {name: "consistent target source", repo: &target, source: &target, trusted: true}, {name: "fork checkout", repo: &fork, source: &fork}, {name: "contradictory source", repo: &fork, source: &target}, {name: "missing checkout", source: &target}, } { t.Run(tc.name, func(t *testing.T) { metadata := &tangled.Pipeline_TriggerMetadata{SourceRepo: tc.source} if tc.repo != nil { metadata.Repo = &tangled.Pipeline_TriggerRepo{RepoDid: tc.repo} } if got := TrustedPipelineSource(metadata, target); got != tc.trusted { t.Fatalf("TrustedPipelineSource() = %t, want %t", got, tc.trusted) } }) }}