mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
Minor test improvements
This commit is contained in:
parent
a6ea1e6b55
commit
362ead2760
2 changed files with 14 additions and 2 deletions
12
caddy/assets/path_test.go
Normal file
12
caddy/assets/path_test.go
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package assets
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPath(t *testing.T) {
|
||||||
|
if actual := Path(); !strings.HasSuffix(actual, ".caddy") {
|
||||||
|
t.Errorf("Expected path to be a .caddy folder, got: %v", actual)
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,14 +10,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rsaKeySizeToUse = 128 // makes tests faster
|
rsaKeySizeToUse = 128 // make tests faster; small key size OK for testing
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSaveAndLoadRSAPrivateKey(t *testing.T) {
|
func TestSaveAndLoadRSAPrivateKey(t *testing.T) {
|
||||||
keyFile := "test.key"
|
keyFile := "test.key"
|
||||||
defer os.Remove(keyFile)
|
defer os.Remove(keyFile)
|
||||||
|
|
||||||
privateKey, err := rsa.GenerateKey(rand.Reader, 128) // small key size is OK for testing
|
privateKey, err := rsa.GenerateKey(rand.Reader, rsaKeySizeToUse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue