847989df75
- git mv cmd/ internal/ pkg/ test/ go.mod go.sum Makefile build.sh docs/ v1/ - Create v1/README.md with V1 documentation - Update root README for V1 + V2 structure - V1 still builds (cd v1 && go build ./cmd/hostkeeper) and 105 tests pass - Root is now clean for V2 development
35 lines
774 B
Go
35 lines
774 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestEditCommandExists(t *testing.T) {
|
|
if editCmd == nil {
|
|
t.Fatal("editCmd should not be nil")
|
|
}
|
|
|
|
if editCmd.Use != "edit <host-name-or-id>" {
|
|
t.Errorf("expected Use 'edit <host-name-or-id>', got '%s'", editCmd.Use)
|
|
}
|
|
|
|
if editCmd.Short == "" {
|
|
t.Error("Short description should not be empty")
|
|
}
|
|
}
|
|
|
|
func TestEditCommandFlags(t *testing.T) {
|
|
expectedFlags := []string{"host", "port", "user", "password", "key", "auth-type", "group", "tags", "notes", "name"}
|
|
for _, flagName := range expectedFlags {
|
|
if editCmd.Flags().Lookup(flagName) == nil {
|
|
t.Errorf("flag '%s' should be defined", flagName)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestEditArgs(t *testing.T) {
|
|
if editCmd.Args == nil {
|
|
t.Error("Args validator should not be nil")
|
|
}
|
|
}
|