tests: fix utils tests

This commit is contained in:
Stavros
2026-05-04 20:18:34 +03:00
parent 26daef7d4e
commit ff3c25c09d
4 changed files with 66 additions and 69 deletions
+11 -11
View File
@@ -3,7 +3,7 @@ package decoders_test
import (
"testing"
"github.com/tinyauthapp/tinyauth/internal/config"
"github.com/tinyauthapp/tinyauth/internal/model"
"github.com/tinyauthapp/tinyauth/internal/utils/decoders"
"gotest.tools/v3/assert"
@@ -11,34 +11,34 @@ import (
func TestDecodeLabels(t *testing.T) {
// Variables
expected := config.Apps{
Apps: map[string]config.App{
expected := model.Apps{
Apps: map[string]model.App{
"foo": {
Config: config.AppConfig{
Config: model.AppConfig{
Domain: "example.com",
},
Users: config.AppUsers{
Users: model.AppUsers{
Allow: "user1,user2",
Block: "user3",
},
OAuth: config.AppOAuth{
OAuth: model.AppOAuth{
Whitelist: "somebody@example.com",
Groups: "group3",
},
IP: config.AppIP{
IP: model.AppIP{
Allow: []string{"10.71.0.1/24", "10.71.0.2"},
Block: []string{"10.10.10.10", "10.0.0.0/24"},
Bypass: []string{"192.168.1.1"},
},
Response: config.AppResponse{
Response: model.AppResponse{
Headers: []string{"X-Foo=Bar", "X-Baz=Qux"},
BasicAuth: config.AppBasicAuth{
BasicAuth: model.AppBasicAuth{
Username: "admin",
Password: "password",
PasswordFile: "/path/to/passwordfile",
},
},
Path: config.AppPath{
Path: model.AppPath{
Allow: "/public",
Block: "/private",
},
@@ -63,7 +63,7 @@ func TestDecodeLabels(t *testing.T) {
}
// Test
result, err := decoders.DecodeLabels[config.Apps](test, "apps")
result, err := decoders.DecodeLabels[model.Apps](test, "apps")
assert.NilError(t, err)
assert.DeepEqual(t, expected, result)
}