Fixed config tests
This commit is contained in:
parent
89269b7aad
commit
47ef82966c
9
Makefile
9
Makefile
@ -3,11 +3,14 @@
|
|||||||
all: dev
|
all: dev
|
||||||
|
|
||||||
dev: build
|
dev: build
|
||||||
./pastebin -bind 127.0.0.1:8000
|
./pastebin
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
go get ./...
|
go get ./...
|
||||||
go build -o ./pastebin .
|
go build .
|
||||||
|
|
||||||
|
test:
|
||||||
|
go test ./...
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf bin pastebin
|
rm -rf pastebin
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@ -10,14 +11,14 @@ func TestZeroConfig(t *testing.T) {
|
|||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
cfg := Config{}
|
cfg := Config{}
|
||||||
assert.Equal(cfg.expiry, 0)
|
assert.Equal(cfg.expiry, 0*time.Second)
|
||||||
assert.Equal(cfg.fqdn, "")
|
assert.Equal(cfg.fqdn, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfig(t *testing.T) {
|
func TestConfig(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
cfg := Config{expiry: 1800, fqdn: "https://localhost"}
|
cfg := Config{expiry: 30 * time.Minute, fqdn: "https://localhost"}
|
||||||
assert.Equal(cfg.expiry, 1800)
|
assert.Equal(cfg.expiry, 30*time.Minute)
|
||||||
assert.Equal(cfg.fqdn, "https://localhost")
|
assert.Equal(cfg.fqdn, "https://localhost")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user