25 lines
1.1 KiB
Go
25 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// The seed and the daemon read ONE environment variable and have to name ONE identity with it. The
|
|
// daemon trims it (config.Load) and this side did not, so a value with a stray newline signed in as
|
|
// the trimmed identity and then looked up the padded one — after the sign-in had already created the
|
|
// account and spent its one-time signup grant, leaving a half-seeded stand (acceptance dofix ФП-6).
|
|
//
|
|
// Pinned where a unit test can reach it: a subject that is nothing but padding is the empty subject,
|
|
// and the walk ends before it touches anything. The URL names a port nothing serves, so "it went to
|
|
// the daemon anyway" fails with a different, recognisable message rather than passing.
|
|
func TestASubjectThatIsOnlyPaddingIsNoSubject(t *testing.T) {
|
|
err := seed(t.Context(), nil, []string{"--url", "http://127.0.0.1:1", "--subject", " \n\t"}, io.Discard)
|
|
if err == nil {
|
|
t.Fatal("a blank subject was accepted")
|
|
}
|
|
if !strings.Contains(err.Error(), "--subject") {
|
|
t.Fatalf("the walk carried a blank subject to the daemon: %v", err)
|
|
}
|
|
}
|