github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/sdk/exttest/apibenchmark.go (about) 1 // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. 2 // 3 // This software (Documize Community Edition) is licensed under 4 // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html 5 // 6 // You can operate outside the AGPL restrictions by purchasing 7 // Documize Enterprise Edition and obtaining a commercial license 8 // by contacting <sales@documize.com>. 9 // 10 // https://documize.com 11 12 package exttest 13 14 import ( 15 "errors" 16 "os" 17 18 "github.com/documize/community/sdk" 19 ) 20 21 // APIbenchmark is the main entry point for the benchmark code, it is called by both internal and external tests. 22 func APIbenchmark() error { 23 testEndPt := os.Getenv("DOCUMIZEAPI") //e.g. "http://localhost:5002" 24 testAuth := os.Getenv("DOCUMIZEAUTH") //e.g. "demo1:jim@davidson.com:demo123" 25 c, err := documize.NewClient(testEndPt, testAuth) // should work 26 if err != nil { 27 return err 28 } 29 folders, err := c.GetNamedFolderIDs("Test") 30 if err != nil { 31 return err 32 } 33 if len(folders) == 0 { 34 return errors.New("no Test folder for test user") 35 } 36 testFolder := folders[0] 37 _ = testFolder 38 // TODO add benchmark code 39 return nil 40 }