File tree Expand file tree Collapse file tree 2 files changed +23
-15
lines changed
Expand file tree Collapse file tree 2 files changed +23
-15
lines changed Original file line number Diff line number Diff line change 55package deploy_test
66
77import (
8- "bytes"
98 "testing"
109
1110 "github.com/toeirei/keymaster/internal/core"
@@ -14,16 +13,6 @@ import (
1413 "github.com/toeirei/keymaster/internal/model"
1514)
1615
17- // fakeDeployer implements core.RemoteDeployer for tests.
18- type fakeDeployer struct {
19- content []byte
20- seen string
21- }
22-
23- func (f * fakeDeployer ) DeployAuthorizedKeys (content string ) error { f .seen = content ; return nil }
24- func (f * fakeDeployer ) GetAuthorizedKeys () ([]byte , error ) { return f .content , nil }
25- func (f * fakeDeployer ) Close () {}
26-
2716func TestAuditAccountSerial_Errors (t * testing.T ) {
2817 if err := db .InitDB ("sqlite" , ":memory:" ); err != nil {
2918 t .Fatalf ("db.InitDB failed: %v" , err )
@@ -91,7 +80,4 @@ func TestAuditAccountStrict_DriftDetected(t *testing.T) {
9180 }
9281}
9382
94- // small helpers to avoid importing bytes package directly in test bodies
95- // small helpers to avoid importing bytes package directly in test bodies
96- // small helpers to avoid importing bytes package directly in test bodies
97- func bytesFromString (s string ) * bytes.Buffer { return bytes .NewBufferString (s ) }
83+ // bytesFromString is provided by testhelpers_test.go
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025 ToeiRei
2+ // Keymaster - SSH key management system
3+ // This source code is licensed under the MIT license found in the LICENSE file.
4+
5+ package deploy_test
6+
7+ import "bytes"
8+
9+ // fakeDeployer implements core.RemoteDeployer for tests and is shared
10+ // so multiple test files can override `core.NewDeployerFactory` without
11+ // redeclaring the type.
12+ type fakeDeployer struct {
13+ content []byte
14+ seen string
15+ }
16+
17+ func (f * fakeDeployer ) DeployAuthorizedKeys (content string ) error { f .seen = content ; return nil }
18+ func (f * fakeDeployer ) GetAuthorizedKeys () ([]byte , error ) { return f .content , nil }
19+ func (f * fakeDeployer ) Close () {}
20+
21+ // bytesFromString is a small helper used by tests to create buffers.
22+ func bytesFromString (s string ) * bytes.Buffer { return bytes .NewBufferString (s ) }
You can’t perform that action at this time.
0 commit comments