From e62081b1219099dbc47734e8ff1180fc0accf134 Mon Sep 17 00:00:00 2001 From: Kian Parvin Date: Fri, 14 Jun 2024 13:27:16 +0200 Subject: [PATCH] Update reading test auth model --- internal/jimmtest/openfga.go | 37 +----------------------------------- 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/internal/jimmtest/openfga.go b/internal/jimmtest/openfga.go index c410623a3..a32ae6939 100644 --- a/internal/jimmtest/openfga.go +++ b/internal/jimmtest/openfga.go @@ -4,11 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/fs" - "io/ioutil" "os" - "path" - "path/filepath" "strings" "sync" @@ -39,38 +35,7 @@ type testSetup struct { } func getAuthModelDefinition() (*sdk.AuthorizationModel, error) { - desiredFolder := "local" - authPath := "" - var pwd string - pwd, err := os.Getwd() - if err != nil { - return nil, err - } - for ok := true; ok; { - if pwd == "/" { - break - } - var files []fs.FileInfo - files, err = ioutil.ReadDir(pwd) - if err != nil { - return nil, err - } - - for _, f := range files { - if f.Name() == desiredFolder { - ok = true - authPath = pwd - } - } - // Move up a directory - pwd = filepath.Dir(pwd) - } - if authPath == "" { - err = fmt.Errorf("auth path is empty") - return nil, err - } - - b, err := os.ReadFile(path.Join(authPath, "/local/openfga/authorisation_model.json")) + b, err := os.ReadFile("../../openfga/authorisation_model.json") if err != nil { return nil, err }