Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Mar 5, 2024
1 parent 1b8a064 commit 498ab05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ import (
"gopkg.in/yaml.v2"
)

// DefaultIssueBodyTemplate is the default template used for `issue_body_template` in the config.
//
// !!! Keep in step with the documentation in `rageshake.sample.yaml` !!!
const DEFAULT_ISSUE_BODY_TEMPLATE = `User message:
const DefaultIssueBodyTemplate = `User message:
{{ .UserText }}
{{ range $key, $val := .Data -}}
Expand Down Expand Up @@ -121,7 +123,7 @@ func main() {

issueTemplate := cfg.IssueBodyTemplate
if issueTemplate == "" {
issueTemplate = DEFAULT_ISSUE_BODY_TEMPLATE
issueTemplate = DefaultIssueBodyTemplate
}
parsedIssueTemplate, err := template.New("issue").Parse(issueTemplate)
if err != nil {
Expand Down
15 changes: 7 additions & 8 deletions submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ func testParsePayload(t *testing.T, body, contentType string, tempDir string) (*
return p, rr.Result()
}


func submitSimpleRequestToServer(t *testing.T, allowedAppNameMap map[string]bool, body string) int {
// Submit a request without files to the server and return statusCode
// Could be extended with more complicated config; aimed here just to
// test options for allowedAppNameMap
// Submit a request without files to the server and return statusCode
// Could be extended with more complicated config; aimed here just to
// test options for allowedAppNameMap

req, err := http.NewRequest("POST", "/api/submit", strings.NewReader(body))
if err != nil {
Expand Down Expand Up @@ -445,7 +444,7 @@ Content-Disposition: form-data; name="version"
t.Fatal("parseRequest returned nil")
}

parsedIssueTemplate := template.Must(template.New("issue").Parse(DEFAULT_ISSUE_BODY_TEMPLATE))
parsedIssueTemplate := template.Must(template.New("issue").Parse(DefaultIssueBodyTemplate))
issueReq, err := buildGithubIssueRequest(*p, "http://test/listing/foo", parsedIssueTemplate)
if err != nil {
t.Fatalf("Error building issue request: %s", err)
Expand Down Expand Up @@ -481,7 +480,7 @@ riot-web
t.Fatal("parseRequest returned nil")
}

parsedIssueTemplate := template.Must(template.New("issue").Parse(DEFAULT_ISSUE_BODY_TEMPLATE))
parsedIssueTemplate := template.Must(template.New("issue").Parse(DefaultIssueBodyTemplate))
issueReq, err := buildGithubIssueRequest(*p, "http://test/listing/foo", parsedIssueTemplate)
if err != nil {
t.Fatalf("Error building issue request: %s", err)
Expand Down Expand Up @@ -511,7 +510,7 @@ Content-Disposition: form-data; name="text"
t.Fatal("parseRequest returned nil")
}

parsedIssueTemplate := template.Must(template.New("issue").Parse(DEFAULT_ISSUE_BODY_TEMPLATE))
parsedIssueTemplate := template.Must(template.New("issue").Parse(DefaultIssueBodyTemplate))
issueReq, err := buildGithubIssueRequest(*p, "http://test/listing/foo", parsedIssueTemplate)
if err != nil {
t.Fatalf("Error building issue request: %s", err)
Expand Down Expand Up @@ -568,7 +567,7 @@ user_id: id
}
}

parsedIssueTemplate := template.Must(template.New("issue").Parse(DEFAULT_ISSUE_BODY_TEMPLATE))
parsedIssueTemplate := template.Must(template.New("issue").Parse(DefaultIssueBodyTemplate))
for k, v := range sample {
p := payload{Data: v.data}
res, err := buildGithubIssueRequest(p, "", parsedIssueTemplate)
Expand Down

0 comments on commit 498ab05

Please sign in to comment.