Fixed config tests
This commit is contained in:
		
							
								
								
									
										9
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								Makefile
									
									
									
									
									
								
							@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user