refac: removed 7 direct and 12 indirect go modules for custom code instead
This commit is contained in:
1 parent
cfcf108488
commit
c68e9a7858
73 files changed
+2455
-428
No files matched your search
@@ -20,14 +20,14 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-chi/jwtauth/v5"
|
||||
"RenewCMS/api/pkg/authtoken"
|
||||
)
|
||||
|
||||
const restartPath = "/update/restart"
|
||||
|
||||
type restartHTTP struct {
|
||||
router http.Handler
|
||||
token *jwtauth.JWTAuth
|
||||
token *authtoken.Auth
|
||||
dataDir string
|
||||
markerPath string
|
||||
resultPath string
|
||||
@@ -44,7 +44,7 @@ func newRestartHTTP(t *testing.T) *restartHTTP {
|
||||
validator.InitValidator()
|
||||
dataDir := t.TempDir()
|
||||
h := &restartHTTP{
|
||||
token: jwtauth.New("HS256", []byte("test-secret"), nil),
|
||||
token: authtoken.New([]byte("test-secret")),
|
||||
dataDir: dataDir,
|
||||
markerPath: filepath.Join(dataDir, update.RestartRequestFileName),
|
||||
resultPath: filepath.Join(dataDir, update.ResultFileName),
|
||||
@@ -86,7 +86,7 @@ func (h *restartHTTP) request(t *testing.T, method string, target string, userId
|
||||
t.Helper()
|
||||
req := httptest.NewRequest(method, target, strings.NewReader(body))
|
||||
if userId != 0 {
|
||||
_, tokenString, err := h.token.Encode(map[string]any{"user_id": userId, "token_version": tokenVersion})
|
||||
tokenString, err := h.token.Encode(map[string]any{"user_id": userId, "token_version": tokenVersion})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -554,7 +554,7 @@ func TestRestartResultLivesUntilTheNextJob(t *testing.T) {
|
||||
func TestHealthzIsUnchanged(t *testing.T) {
|
||||
t.Run("Healthz is unchanged", func(t *testing.T) {
|
||||
container := &api.UseCases{
|
||||
Token: jwtauth.New("HS256", []byte("test-secret"), nil),
|
||||
Token: authtoken.New([]byte("test-secret")),
|
||||
OpenMediaUseCase: useCases.NewOpenMediaUseCase(storage.NewLocalStorage(t.TempDir())),
|
||||
}
|
||||
router := api.InitRoutes(container, config.Settings{Environment: "production"})
|
||||
@@ -615,7 +615,7 @@ func TestRunningInfoFileAtStartup(t *testing.T) {
|
||||
|
||||
t.Run("the file is not served by any route", func(t *testing.T) {
|
||||
container := &api.UseCases{
|
||||
Token: jwtauth.New("HS256", []byte("test-secret"), nil),
|
||||
Token: authtoken.New([]byte("test-secret")),
|
||||
OpenMediaUseCase: useCases.NewOpenMediaUseCase(storage.NewLocalStorage(t.TempDir())),
|
||||
}
|
||||
router := api.InitRoutes(container, config.Settings{Environment: "production"})
|
||||
|
||||
Reference in new issue
Block a user