From a7c5b315bcad856c093b756ab0998a9fad16cd25 Mon Sep 17 00:00:00 2001 From: Denis Grigor Date: Tue, 2 Jun 2020 21:08:20 -0400 Subject: [PATCH] added test to DA --- da/da_test.go | 8 ++++---- da/user.go | 5 ++++- go.mod | 3 +++ recap/types.go | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 go.mod diff --git a/da/da_test.go b/da/da_test.go index b87fc02..d45886c 100644 --- a/da/da_test.go +++ b/da/da_test.go @@ -84,7 +84,7 @@ func TestAPI_AppBundle(t *testing.T) { testAppName := "GolangSDKTest" testEngine := "Autodesk.3dsMax+2019" - var testAlias da.Alias + //var testAlias da.Alias var app da.AppBundle nickname, err := daApi.UserId() @@ -100,7 +100,7 @@ func TestAPI_AppBundle(t *testing.T) { if app.ID != nickname+"."+testAppName { t.Fatalf("The id of created app mismatch: expect '%s', got '%s'", - testAppName, + nickname+"."+testAppName, app.ID) } }) @@ -124,7 +124,7 @@ func TestAPI_AppBundle(t *testing.T) { }) t.Run("Create alias for app", func(t *testing.T) { - testAlias, err = app.CreateAlias("test", 1) + _, err := app.CreateAlias("test", 1) if err != nil { t.Fatalf("Could not create alias: %s", err.Error()) } @@ -507,7 +507,7 @@ func TestAPI_Activity(t *testing.T) { } - testActivity, err := daApi.CreateActivity(config) + testActivity, err = daApi.CreateActivity(config) if err != nil { t.Fatal(err.Error()) } diff --git a/da/user.go b/da/user.go index cedf4ef..2564b41 100644 --- a/da/user.go +++ b/da/user.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "net/http" "strconv" + "strings" ) func getUserID(path string, token string) (nickname string, err error) { @@ -33,7 +34,9 @@ func getUserID(path string, token string) (nickname string, err error) { return } - nickname = string(data) + //TODO: Review why the data has quotes in its content and find a more elegant way to remove them + nickname = strings.Replace(string(data), "\"", "", -1 ) + return } diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b3ca76a --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/apprentice3d/forge-api-go-client + +go 1.12 diff --git a/recap/types.go b/recap/types.go index 4a3737c..1542c4a 100644 --- a/recap/types.go +++ b/recap/types.go @@ -119,7 +119,7 @@ type ErrorMessage struct { // BUG(apprentice3d) Frequently the operation succeeded with returning code 200, meaning that the task was // received successfully, but failed to execute due to reasons specified in message -// (g.e. uploading a file by specifying an wrong link: POST request is successful, +// (g.e. uploading a file by specifying a wrong link: POST request is successful, // but internally it failed to download the file because of the wrongly provided link) // Error is inner struct encountered in cases when the server reported status OK, but still contains details