mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 05:32:02 +08:00
* recover middleware * simplify Atoi * metadata data prototype * InterestingAttention * resize itself * Bump version to 0.9.4 Added some comments Removed String() for Extraparams * Add metadata test * Fix CI * Remove unnecessary tests * Update file count * use t.Run to get test case --------- Co-authored-by: n0vad3v <n0vad3v@riseup.net>
32 lines
648 B
Go
32 lines
648 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
ConfigPath = "../config.json"
|
|
m.Run()
|
|
ConfigPath = "config.json"
|
|
Config.ImgPath = "./pics"
|
|
}
|
|
|
|
func TestLoadConfig(t *testing.T) {
|
|
LoadConfig()
|
|
assert.Equal(t, Config.Host, "127.0.0.1")
|
|
assert.Equal(t, Config.Port, "3333")
|
|
assert.Equal(t, Config.Quality, 80)
|
|
assert.Equal(t, Config.ImgPath, "./pics")
|
|
assert.Equal(t, Config.ExhaustPath, "./exhaust")
|
|
}
|
|
|
|
func TestSwitchProxyMode(t *testing.T) {
|
|
switchProxyMode()
|
|
assert.False(t, ProxyMode)
|
|
Config.ImgPath = "https://picsum.photos"
|
|
switchProxyMode()
|
|
assert.True(t, ProxyMode)
|
|
}
|