webp_server_go/config/config_test.go
Benny a7b5992662
Metadata (#251)
* 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>
2023-07-11 19:08:32 +02:00

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)
}