From e0c10189ec69e38ae2de5212dd9fd4c2af1bc157 Mon Sep 17 00:00:00 2001 From: Vishnu Jayadevan Date: Wed, 7 Feb 2024 16:07:21 +0530 Subject: [PATCH 1/4] refactor: break down the report command --- command/report/client.go | 133 +++++++++++++++++++++++++++ command/report/client_test.go | 62 +++++++++++++ command/report/report.go | 165 +++++++--------------------------- 3 files changed, 228 insertions(+), 132 deletions(-) create mode 100644 command/report/client.go create mode 100644 command/report/client_test.go diff --git a/command/report/client.go b/command/report/client.go new file mode 100644 index 00000000..a50de194 --- /dev/null +++ b/command/report/client.go @@ -0,0 +1,133 @@ +package report + +import ( + "context" + "crypto/tls" + "net/http" + "time" + + "github.com/deepsourcelabs/graphql" +) + +type Client struct { + gql *graphql.Client +} + +func NewGraphQLClient(url string, skipCertificateVerification bool) *Client { + httpClient := &http.Client{ + Timeout: time.Second * 60, + } + if skipCertificateVerification { + tr := &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + } + httpClient.Transport = tr + } + + gql := graphql.NewClient(url, graphql.WithHTTPClient(httpClient)) + return &Client{gql: gql} +} + +const artifactMetadataInputQuery = `query { + __type(name: "ArtifactMetadataInput") { + inputFields { + name + } + } +}` + +type InputFields struct { + Name string `json:"name"` +} + +type Type struct { + InputFields []InputFields `json:"inputFields"` +} + +type ArtifactMetadataInputResponse struct { + Type Type `json:"__type"` +} + +func (c *Client) CompressionEnabled() (bool, error) { + req := graphql.NewRequest(artifactMetadataInputQuery) + var resp = ArtifactMetadataInputResponse{} + + err := c.gql.Run(context.Background(), req, &resp) + if err != nil { + return false, err + } + + for _, field := range resp.Type.InputFields { + if field.Name == "compressed" { + return true, nil + } + } + return false, nil +} + +const createArtifactMutationNew = `mutation($input: CreateArtifactInput!) { + createArtifact(input: $input) { + ok + message + error + } +}` + +const createArtifactMutationOld = `mutation($input: CreateArtifactInput!) { + createArtifact(input: $input) { + ok + error + } +}` + +type CreateArtifactResponse struct { + CreateArtifact CreateArtifact `json:"createArtifact"` +} + +type CreateArtifact struct { + Error string `json:"error"` + Message string `json:"message"` + Ok bool `json:"ok"` +} + +type CreateArtifactInput struct { + AccessToken string `json:"accessToken"` + CommitOID string `json:"commitOid"` + ReporterName string `json:"reporter"` + ReporterVersion string `json:"reporterVersion"` + Key string `json:"key"` + Data string `json:"data"` + AnalyzerShortcode string `json:"analyzer"` + AnalyzerType string `json:"analyzerType,omitempty"` + Metadata interface{} `json:"metadata,omitempty"` +} + +func (c *Client) SendReportNew(input *CreateArtifactInput) (*CreateArtifactResponse, error) { + req := graphql.NewRequest(createArtifactMutationNew) + req.Var("input", input) + + resp := CreateArtifactResponse{} + + err := c.gql.Run(context.Background(), req, &resp) + if err != nil { + return nil, err + } + + return &resp, nil +} + +func (c *Client) SendReportOld(input *CreateArtifactInput) (*CreateArtifactResponse, error) { + req := graphql.NewRequest(createArtifactMutationOld) + req.Var("input", input) + + resp := CreateArtifactResponse{} + + err := c.gql.Run(context.Background(), req, &resp) + if err != nil { + return nil, err + } + + return &resp, nil +} diff --git a/command/report/client_test.go b/command/report/client_test.go new file mode 100644 index 00000000..6ab84fe8 --- /dev/null +++ b/command/report/client_test.go @@ -0,0 +1,62 @@ +package report + +import ( + "net/http" + "net/http/httptest" + "testing" +) + +func TestClient_CompressionEnabled(t *testing.T) { + tests := []struct { + name string + response string + responseErr bool + want bool + wantErr bool + }{ + { + name: "compression enabled", + response: `{"data":{"__type":{"inputFields":[{"name":"compressed"}]}}}`, + want: true, + wantErr: false, + }, + { + name: "compression disabled", + response: `{"data":{"__type":{"inputFields":[{"name":"not_compressed"}]}}}`, + want: false, + wantErr: false, + }, + { + name: "error", + responseErr: true, + want: false, + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if tt.responseErr { + w.WriteHeader(http.StatusInternalServerError) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + if _, err := w.Write([]byte(tt.response)); err != nil { + t.Error(err) + } + })) + + client := NewGraphQLClient(server.URL, false) + got, err := client.CompressionEnabled() + if (err != nil) != tt.wantErr { + t.Errorf("Client.CompressionEnabled() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("Client.CompressionEnabled() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/command/report/report.go b/command/report/report.go index 30bc954e..0e6537d5 100644 --- a/command/report/report.go +++ b/command/report/report.go @@ -2,7 +2,6 @@ package report import ( "encoding/base64" - "encoding/json" "errors" "fmt" "log" @@ -166,19 +165,10 @@ func (opts *ReportOptions) Run() int { return 1 } - var analyzerShortcode string - var analyzerType string - var artifactKey string var artifactValue string - - analyzerShortcode = opts.Analyzer - analyzerType = opts.AnalyzerType - artifactKey = opts.Key - if opts.Value != "" { artifactValue = opts.Value } - if opts.ValueFile != "" { // Check file size _, err := os.Stat(opts.ValueFile) @@ -198,162 +188,73 @@ func (opts *ReportOptions) Run() int { artifactValue = string(valueBytes) } - // Query DeepSource API to check if compression is supported - q := ReportQuery{Query: graphqlCheckCompressed} - - qBytes, err := json.Marshal(q) - if err != nil { - fmt.Fprintln(os.Stderr, "DeepSource | Error | Failed to marshal query:", err) - sentry.CaptureException(err) - return 1 - } - - r, err := makeQuery( - dsn.Protocol+"://"+dsn.Host+"/graphql/cli/", - qBytes, - "application/json", - opts.SkipCertificateVerification, - ) - if err != nil { - fmt.Fprintln(os.Stderr, "DeepSource | Error | Failed to make query:", err) - sentry.CaptureException(err) - return 1 - } - - // res is a struct to unmarshal the response to check if compression is supported - var res struct { - Data struct { - Type struct { - InputFields []struct { - Name string `json:"name"` - } `json:"inputFields"` - } `json:"__type"` - } `json:"data"` - } - - err = json.Unmarshal(r, &res) + client := NewGraphQLClient(dsn.Protocol+"://"+dsn.Host+"/graphql/cli/", opts.SkipCertificateVerification) + mustCompress, err := client.CompressionEnabled() if err != nil { - fmt.Fprintln(os.Stderr, "DeepSource | Error | Failed to unmarshal response:", err) + fmt.Fprintln(os.Stderr, "DeepSource | Error | Unable to check if compression is supported") sentry.CaptureException(err) - return 1 } reportMeta := make(map[string]interface{}) reportMeta["workDir"] = currentDir // Compress the value if compression is supported - for _, inputField := range res.Data.Type.InputFields { - if inputField.Name == "compressed" { - // Compress the byte array - var compressedBytes []byte - compressLevel := 20 - compressedBytes, err = zstd.CompressLevel(compressedBytes, []byte(artifactValue), compressLevel) - if err != nil { - fmt.Fprintln(os.Stderr, "DeepSource | Error | Failed to compress value file:", opts.ValueFile) - sentry.CaptureException(err) - return 1 - } - - // Base64 encode the compressed byte array - artifactValue = base64.StdEncoding.EncodeToString(compressedBytes) - - // Set the compression flag - reportMeta["compressed"] = "True" + + if mustCompress { + // Compress the byte array + var compressedBytes []byte + compressLevel := 20 + compressedBytes, err = zstd.CompressLevel(compressedBytes, []byte(artifactValue), compressLevel) + if err != nil { + fmt.Fprintln(os.Stderr, "DeepSource | Error | Failed to compress value file:", opts.ValueFile) + sentry.CaptureException(err) + return 1 } - } - //////////////////// - // Generate query // - //////////////////// + // Base64 encode the compressed byte array + artifactValue = base64.StdEncoding.EncodeToString(compressedBytes) - queryInput := ReportQueryInput{ + // Set the compression flag + reportMeta["compressed"] = "True" + } + + queryInput := CreateArtifactInput{ AccessToken: dsn.Token, CommitOID: headCommitOID, ReporterName: "cli", ReporterVersion: CliVersion, - Key: artifactKey, + Key: opts.Key, Data: artifactValue, - AnalyzerShortcode: analyzerShortcode, + AnalyzerShortcode: opts.Analyzer, + AnalyzerType: opts.AnalyzerType, // AnalyzerType: analyzerType, // Add this in the later steps, only is the analyzer type is passed. // This makes sure that the cli is always backwards compatible. The API is designed to accept analyzer type only if it is passed. Metadata: reportMeta, } - query := ReportQuery{Query: reportGraphqlQuery} - // Check if analyzerType is passed and add it to the queryInput - if analyzerType != "" { - queryInput.AnalyzerType = analyzerType - } - // Pass queryInput to the query - query.Variables.Input = queryInput - - // Marshal request body - queryBodyBytes, err := json.Marshal(query) - if err != nil { - fmt.Fprintln(os.Stderr, "DeepSource | Error | Unable to marshal query body") - sentry.CaptureException(err) - return 1 - } - - queryResponseBody, err := makeQuery( - dsn.Protocol+"://"+dsn.Host+"/graphql/cli/", - queryBodyBytes, - "application/json", - opts.SkipCertificateVerification, - ) + var res *CreateArtifactResponse + res, err = client.SendReportNew(&queryInput) if err != nil { // Make Query without message field. - query := ReportQuery{Query: reportGraphqlQueryOld} - query.Variables.Input = queryInput - queryBodyBytes, err := json.Marshal(query) - if err != nil { - fmt.Fprintln(os.Stderr, "DeepSource | Error | Unable to marshal query body") - sentry.CaptureException(err) - return 1 - } - queryResponseBody, err = makeQuery( - dsn.Protocol+"://"+dsn.Host+"/graphql/cli/", - queryBodyBytes, - "application/json", - opts.SkipCertificateVerification, - ) + res, err = client.SendReportOld(&queryInput) if err != nil { fmt.Fprintln(os.Stderr, "DeepSource | Error | Reporting failed |", err) sentry.CaptureException(err) return 1 } } - // Parse query's response body - queryResponse := QueryResponse{} - err = json.Unmarshal(queryResponseBody, &queryResponse) - if err != nil { - fmt.Fprintln(os.Stderr, "DeepSource | Error | Unable to parse response body") - sentry.CaptureException(err) - return 1 - } - // Check for errors in response body - // Response format: - // { - // "data": { - // "createArtifact": { - // "ok": false, - // "error": "No repository found attached with the access token: dasdsds" - // } - // } - // } - - if !queryResponse.Data.CreateArtifact.Ok { - fmt.Fprintln(os.Stderr, "DeepSource | Error | Reporting failed |", queryResponse.Data.CreateArtifact.Error) - sentry.CaptureException(errors.New(queryResponse.Data.CreateArtifact.Error)) + if !res.CreateArtifact.Ok { + fmt.Fprintln(os.Stderr, "DeepSource | Error | Reporting failed |", res.CreateArtifact.Error) + sentry.CaptureException(errors.New(res.CreateArtifact.Error)) return 1 } fmt.Printf("DeepSource | Artifact published successfully\n\n") - fmt.Printf("Analyzer %s\n", analyzerShortcode) - fmt.Printf("Key %s\n", artifactKey) - if queryResponse.Data.CreateArtifact.Message != "" { - fmt.Printf("Message %s\n", queryResponse.Data.CreateArtifact.Message) + fmt.Printf("Analyzer %s\n", opts.Analyzer) + fmt.Printf("Key %s\n", opts.Key) + if res.CreateArtifact.Message != "" { + fmt.Printf("Message %s\n", res.CreateArtifact.Message) } if warning != "" { fmt.Print(warning) From 1d89f60a8cc9ad6ab4b95ecc1109a158bd4f4fb4 Mon Sep 17 00:00:00 2001 From: Vishnu Jayadevan Date: Wed, 7 Feb 2024 17:08:21 +0530 Subject: [PATCH 2/4] fix: use previous graphql strings --- command/report/client.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/command/report/client.go b/command/report/client.go index a50de194..1671f602 100644 --- a/command/report/client.go +++ b/command/report/client.go @@ -67,20 +67,20 @@ func (c *Client) CompressionEnabled() (bool, error) { return false, nil } -const createArtifactMutationNew = `mutation($input: CreateArtifactInput!) { - createArtifact(input: $input) { - ok - message - error - } -}` - -const createArtifactMutationOld = `mutation($input: CreateArtifactInput!) { - createArtifact(input: $input) { - ok - error - } -}` +// const createArtifactMutationNew = `mutation($input: CreateArtifactInput!) { +// createArtifact(input: $input) { +// ok +// message +// error +// } +// }` + +// const createArtifactMutationOld = `mutation($input: CreateArtifactInput!) { +// createArtifact(input: $input) { +// ok +// error +// } +// }` type CreateArtifactResponse struct { CreateArtifact CreateArtifact `json:"createArtifact"` @@ -105,7 +105,7 @@ type CreateArtifactInput struct { } func (c *Client) SendReportNew(input *CreateArtifactInput) (*CreateArtifactResponse, error) { - req := graphql.NewRequest(createArtifactMutationNew) + req := graphql.NewRequest(reportGraphqlQuery) req.Var("input", input) resp := CreateArtifactResponse{} @@ -119,7 +119,7 @@ func (c *Client) SendReportNew(input *CreateArtifactInput) (*CreateArtifactRespo } func (c *Client) SendReportOld(input *CreateArtifactInput) (*CreateArtifactResponse, error) { - req := graphql.NewRequest(createArtifactMutationOld) + req := graphql.NewRequest(reportGraphqlQueryOld) req.Var("input", input) resp := CreateArtifactResponse{} From 4105ad71ab1185975aceb6b3250f945ab6da87ae Mon Sep 17 00:00:00 2001 From: Vishnu Jayadevan Date: Wed, 7 Feb 2024 17:48:33 +0530 Subject: [PATCH 3/4] fix: add tests --- command/report/client.go | 35 +++---- command/report/client_test.go | 168 ++++++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+), 17 deletions(-) diff --git a/command/report/client.go b/command/report/client.go index 1671f602..f01285e6 100644 --- a/command/report/client.go +++ b/command/report/client.go @@ -3,6 +3,7 @@ package report import ( "context" "crypto/tls" + "fmt" "net/http" "time" @@ -67,20 +68,20 @@ func (c *Client) CompressionEnabled() (bool, error) { return false, nil } -// const createArtifactMutationNew = `mutation($input: CreateArtifactInput!) { -// createArtifact(input: $input) { -// ok -// message -// error -// } -// }` - -// const createArtifactMutationOld = `mutation($input: CreateArtifactInput!) { -// createArtifact(input: $input) { -// ok -// error -// } -// }` +const createArtifactMutationNew = `mutation($input: CreateArtifactInput!) { + createArtifact(input: $input) { + ok + message + error + } +}` + +const createArtifactMutationOld = `mutation($input: CreateArtifactInput!) { + createArtifact(input: $input) { + ok + error + } +}` type CreateArtifactResponse struct { CreateArtifact CreateArtifact `json:"createArtifact"` @@ -105,7 +106,7 @@ type CreateArtifactInput struct { } func (c *Client) SendReportNew(input *CreateArtifactInput) (*CreateArtifactResponse, error) { - req := graphql.NewRequest(reportGraphqlQuery) + req := graphql.NewRequest(createArtifactMutationNew) req.Var("input", input) resp := CreateArtifactResponse{} @@ -114,12 +115,12 @@ func (c *Client) SendReportNew(input *CreateArtifactInput) (*CreateArtifactRespo if err != nil { return nil, err } - + fmt.Println(resp) return &resp, nil } func (c *Client) SendReportOld(input *CreateArtifactInput) (*CreateArtifactResponse, error) { - req := graphql.NewRequest(reportGraphqlQueryOld) + req := graphql.NewRequest(createArtifactMutationOld) req.Var("input", input) resp := CreateArtifactResponse{} diff --git a/command/report/client_test.go b/command/report/client_test.go index 6ab84fe8..771d0b4d 100644 --- a/command/report/client_test.go +++ b/command/report/client_test.go @@ -1,9 +1,15 @@ package report import ( + "encoding/json" + "io" "net/http" "net/http/httptest" + "os" "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestClient_CompressionEnabled(t *testing.T) { @@ -60,3 +66,165 @@ func TestClient_CompressionEnabled(t *testing.T) { }) } } + +type artifactRequest struct { + Query string `json:"query"` + Variables struct { + Input *CreateArtifactInput `json:"input"` + } +} + +type artifactResponse struct { + Data struct { + CreateArtifact CreateArtifact `json:"createArtifact"` + } `json:"data"` +} + +func TestClient_SendReportNew(t *testing.T) { + data, err := os.ReadFile("./tests/golden_files/report_graphql_request_body.json") + require.NoError(t, err, "failed to read test data") + + request := artifactRequest{} + err = json.Unmarshal(data, &request) + require.NoError(t, err, "failed to unmarshal test data") + + input := &CreateArtifactInput{ + AccessToken: request.Variables.Input.AccessToken, + CommitOID: request.Variables.Input.CommitOID, + ReporterName: request.Variables.Input.ReporterName, + ReporterVersion: request.Variables.Input.ReporterVersion, + Data: request.Variables.Input.Data, + AnalyzerShortcode: request.Variables.Input.AnalyzerShortcode, + AnalyzerType: request.Variables.Input.AnalyzerType, + Metadata: request.Variables.Input.Metadata, + } + + t.Run("server success", func(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + body, err := io.ReadAll(r.Body) + require.NoError(t, err, "failed to read request body") + + payload := artifactRequest{} + err = json.Unmarshal(body, &payload) + require.NoError(t, err, "failed to unmarshal request body") + + assert.Equal(t, createArtifactMutationNew, payload.Query) + + response := artifactResponse{ + Data: struct { + CreateArtifact CreateArtifact `json:"createArtifact"` + }{ + CreateArtifact: CreateArtifact{ + Ok: true, + }, + }, + } + + body, err = json.Marshal(response) + require.NoError(t, err, "failed to marshal response") + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/json") + if _, err := w.Write(body); err != nil { + t.Error(err) + } + })) + + client := NewGraphQLClient(server.URL, false) + response, err := client.SendReportNew(input) + + require.NoError(t, err, "failed to send report") + assert.True(t, response.CreateArtifact.Ok, "report failed") + }) + + t.Run("server error", func(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + require.NoError(t, err, "failed to marshal response") + w.WriteHeader(http.StatusInternalServerError) + + })) + + client := NewGraphQLClient(server.URL, false) + response, err := client.SendReportNew(input) + + require.Error(t, err, "expected error") + require.Nil(t, response, "expected nil response") + }) + +} + +func TestClient_SendReportOld(t *testing.T) { + data, err := os.ReadFile("./tests/golden_files/report_graphql_request_body.json") + require.NoError(t, err, "failed to read test data") + + request := artifactRequest{} + err = json.Unmarshal(data, &request) + require.NoError(t, err, "failed to unmarshal test data") + + input := &CreateArtifactInput{ + AccessToken: request.Variables.Input.AccessToken, + CommitOID: request.Variables.Input.CommitOID, + ReporterName: request.Variables.Input.ReporterName, + ReporterVersion: request.Variables.Input.ReporterVersion, + Data: request.Variables.Input.Data, + AnalyzerShortcode: request.Variables.Input.AnalyzerShortcode, + AnalyzerType: request.Variables.Input.AnalyzerType, + Metadata: request.Variables.Input.Metadata, + } + + t.Run("server success", func(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + body, err := io.ReadAll(r.Body) + require.NoError(t, err, "failed to read request body") + + payload := artifactRequest{} + err = json.Unmarshal(body, &payload) + require.NoError(t, err, "failed to unmarshal request body") + + assert.Equal(t, createArtifactMutationOld, payload.Query) + + response := artifactResponse{ + Data: struct { + CreateArtifact CreateArtifact `json:"createArtifact"` + }{ + CreateArtifact: CreateArtifact{ + Ok: true, + Message: "test-message", + Error: "test-error", + }, + }, + } + + body, err = json.Marshal(response) + require.NoError(t, err, "failed to marshal response") + + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "application/json") + if _, err := w.Write(body); err != nil { + t.Error(err) + } + })) + + client := NewGraphQLClient(server.URL, false) + response, err := client.SendReportOld(input) + + require.NoError(t, err, "failed to send report") + assert.True(t, response.CreateArtifact.Ok, "report failed") + assert.Equal(t, "test-message", response.CreateArtifact.Message, "unexpected message") + assert.Equal(t, "test-error", response.CreateArtifact.Error, "unexpected error") + }) + + t.Run("server error", func(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + require.NoError(t, err, "failed to marshal response") + w.WriteHeader(http.StatusInternalServerError) + + })) + + client := NewGraphQLClient(server.URL, false) + response, err := client.SendReportOld(input) + + require.Error(t, err, "expected error") + require.Nil(t, response, "expected nil response") + }) + +} From 389b2501377d7d0a88dc3a8da5f608e938c3d80e Mon Sep 17 00:00:00 2001 From: Vishnu Jayadevan Date: Thu, 8 Feb 2024 12:22:54 +0530 Subject: [PATCH 4/4] fix: fix tests --- command/report/client.go | 2 -- .../golden_files/report_graphql_community_request_body.json | 2 +- .../report/tests/golden_files/report_graphql_request_body.json | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/command/report/client.go b/command/report/client.go index f01285e6..c34704cd 100644 --- a/command/report/client.go +++ b/command/report/client.go @@ -3,7 +3,6 @@ package report import ( "context" "crypto/tls" - "fmt" "net/http" "time" @@ -115,7 +114,6 @@ func (c *Client) SendReportNew(input *CreateArtifactInput) (*CreateArtifactRespo if err != nil { return nil, err } - fmt.Println(resp) return &resp, nil } diff --git a/command/report/tests/golden_files/report_graphql_community_request_body.json b/command/report/tests/golden_files/report_graphql_community_request_body.json index c778e4bb..e88afbb8 100644 --- a/command/report/tests/golden_files/report_graphql_community_request_body.json +++ b/command/report/tests/golden_files/report_graphql_community_request_body.json @@ -1,5 +1,5 @@ { - "query": "mutation($input: CreateArtifactInput!) {\r\n createArtifact(input: $input) {\r\n ok\r\n message\r\n error\r\n }\r\n}", + "query": "mutation($input: CreateArtifactInput!) {\n\tcreateArtifact(input: $input) {\n\t\tok\n\t\tmessage\n\t\terror\n\t}\n}", "variables": { "input": { "accessToken": "f59ab9314307", diff --git a/command/report/tests/golden_files/report_graphql_request_body.json b/command/report/tests/golden_files/report_graphql_request_body.json index 26eb0e1c..6de0c76a 100644 --- a/command/report/tests/golden_files/report_graphql_request_body.json +++ b/command/report/tests/golden_files/report_graphql_request_body.json @@ -1,5 +1,5 @@ { - "query": "mutation($input: CreateArtifactInput!) {\r\n createArtifact(input: $input) {\r\n ok\r\n message\r\n error\r\n }\r\n}", + "query": "mutation($input: CreateArtifactInput!) {\n\tcreateArtifact(input: $input) {\n\t\tok\n\t\tmessage\n\t\terror\n\t}\n}", "variables": { "input": { "accessToken": "f59ab9314307",