Split the unit level from the integration level in cmd, builder, link, catalogue, inventory; cheap fixtures for the archive-entry bound, the registry waits and the catalogue copy (issue 895)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
//go:build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTheArgumentsAreRequired(t *testing.T) {
|
||||
for _, args := range [][]string{
|
||||
{},
|
||||
{"accept"},
|
||||
{"accept", "anchor"},
|
||||
{"accept", "anchor", "umami"},
|
||||
{"give", "anchor", "umami", "database"},
|
||||
} {
|
||||
if err := secretCommand(t.Context(), args); err == nil {
|
||||
t.Errorf("%v was accepted", args)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTheCommandItselfSeesTheFlag(t *testing.T) {
|
||||
err := secretCommand(t.Context(),
|
||||
[]string{"accept", "anchor", "umami", "database", "--from", "/nonexistent/nowhere"})
|
||||
if err == nil {
|
||||
t.Fatal("a missing file was accepted")
|
||||
}
|
||||
if strings.Contains(err.Error(), "secret accept <node>") {
|
||||
t.Fatalf("the command did not see its flag and complained about usage instead: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user