Fixed config tests

This commit is contained in:
James Mills 2017-07-06 22:42:04 -07:00
parent 89269b7aad
commit 47ef82966c
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
2 changed files with 10 additions and 6 deletions

View File

@ -3,11 +3,14 @@
all: dev
dev: build
./pastebin -bind 127.0.0.1:8000
./pastebin
build: clean
go get ./...
go build -o ./pastebin .
go build .
test:
go test ./...
clean:
rm -rf bin pastebin
rm -rf pastebin

View File

@ -2,6 +2,7 @@ package main
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
@ -10,14 +11,14 @@ func TestZeroConfig(t *testing.T) {
assert := assert.New(t)
cfg := Config{}
assert.Equal(cfg.expiry, 0)
assert.Equal(cfg.expiry, 0*time.Second)
assert.Equal(cfg.fqdn, "")
}
func TestConfig(t *testing.T) {
assert := assert.New(t)
cfg := Config{expiry: 1800, fqdn: "https://localhost"}
assert.Equal(cfg.expiry, 1800)
cfg := Config{expiry: 30 * time.Minute, fqdn: "https://localhost"}
assert.Equal(cfg.expiry, 30*time.Minute)
assert.Equal(cfg.fqdn, "https://localhost")
}