1
0
mirror of https://github.com/taigrr/pastebin synced 2026-04-13 22:58:03 -07:00
Files
pastebin/config_test.go
Tai Groot 25f66bb589 feat: modernize codebase and complete API surface
- Update module path from prologic/pastebin to taigrr/pastebin
- Replace go.rice with stdlib embed for templates and static assets
- Replace httprouter with stdlib net/http ServeMux (Go 1.22+)
- Replace namsral/flag with cobra + fang for CLI argument parsing
- Fix inverted TLS insecure logic in client (was negating the flag)
- Close HTTP response body in client
- Use base64 URLEncoding instead of StdEncoding for paste IDs
- Add comprehensive handler tests for all endpoints
- Add client package tests
- Add utils tests for RandomString
- Remove templates.go (replaced by embed)
- Remove unused dependencies (go-metrics, stats, logger, httprouter, go.rice)
2026-03-09 05:44:08 +00:00

27 lines
523 B
Go

package main
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestZeroConfig(t *testing.T) {
cfg := Config{}
assert.Equal(t, time.Duration(0), cfg.Expiry)
assert.Equal(t, "", cfg.FQDN)
assert.Equal(t, "", cfg.Bind)
}
func TestConfig(t *testing.T) {
cfg := Config{
Expiry: 30 * time.Minute,
FQDN: "https://localhost",
Bind: "0.0.0.0:8000",
}
assert.Equal(t, 30*time.Minute, cfg.Expiry)
assert.Equal(t, "https://localhost", cfg.FQDN)
assert.Equal(t, "0.0.0.0:8000", cfg.Bind)
}