From 362ead276098d8f4cdf433a2dba6753962081680 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 27 Oct 2015 12:53:31 -0600 Subject: [PATCH] Minor test improvements --- caddy/assets/path_test.go | 12 ++++++++++++ caddy/letsencrypt/crypto_test.go | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 caddy/assets/path_test.go diff --git a/caddy/assets/path_test.go b/caddy/assets/path_test.go new file mode 100644 index 00000000..374f813a --- /dev/null +++ b/caddy/assets/path_test.go @@ -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) + } +} diff --git a/caddy/letsencrypt/crypto_test.go b/caddy/letsencrypt/crypto_test.go index 938778a8..7f791a6c 100644 --- a/caddy/letsencrypt/crypto_test.go +++ b/caddy/letsencrypt/crypto_test.go @@ -10,14 +10,14 @@ import ( ) func init() { - rsaKeySizeToUse = 128 // makes tests faster + rsaKeySizeToUse = 128 // make tests faster; small key size OK for testing } func TestSaveAndLoadRSAPrivateKey(t *testing.T) { keyFile := "test.key" 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 { t.Fatal(err) }