From b40c7d58868ca4c9d0c1c1192969910fe92cdc73 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Tue, 23 Apr 2019 19:36:52 +0200 Subject: [PATCH] Disable sys routes test --- system/routes_test.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/system/routes_test.go b/system/routes_test.go index 7b0cb9bef..fac7ddd91 100644 --- a/system/routes_test.go +++ b/system/routes_test.go @@ -1,4 +1,4 @@ -// +build integration +// +build integration-disabled package service @@ -35,13 +35,13 @@ type ( } ) -func disabledTestUsers(t *testing.T) { +func TestUsers(t *testing.T) { ctx := context.Background() // we need to set this due to using Init() os.Setenv("SYSTEM_DB_DSN", "crust:crust@tcp(crust-db:3306)/crust?collation=utf8mb4_general_ci") - mountFlags("system", Flags, auth.Flags) + mountFlags("system", Flags) // log to stdout not stderr log.SetOutput(os.Stdout) @@ -51,7 +51,12 @@ func disabledTestUsers(t *testing.T) { err := Init(ctx) test.Assert(t, err == nil, "Error initializing: %+v", err) - routes := Routes(ctx) + jwtSecret := "test-secret" + + jwtAuth, err := auth.JWT(jwtSecret, 600) + test.NoError(t, err, "Error initializing: %v") + + routes := Routes(ctx, jwtAuth) // Send check request with invalid JWT token. { @@ -62,7 +67,10 @@ func disabledTestUsers(t *testing.T) { "id": "zblj", "nbf": time.Date(2015, 10, 10, 12, 0, 0, 0, time.UTC).Unix(), }) - tokenString, err := token.SignedString([]byte("secret")) + + jwtAuth.Encode() + + tokenString, err := token.SignedString([]byte(jwtSecret)) test.Assert(t, err == nil, "Error creating JWT token: %+v", err) req.AddCookie(&http.Cookie{