Skip to content

Commit

Permalink
add tests for validating changes to auto-generated jiradata files
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Oct 28, 2017
1 parent 9000777 commit 41d1a7c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ before_install:
language: go
go_import_path: gopkg.in/Netflix-Skunkworks/go-jira.v1
go:
- 1.8
- 1.9

matrix:
fast_finish: true

script:
- go get -t -v ./...
- go test ./...
- make vet
- make
- make prove 2>&1
- make prove 2>&1

9 changes: 0 additions & 9 deletions issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,15 +571,6 @@ func IssueAttachFile(ua HttpClient, endpoint string, issue, filename string, con
defer resp.Body.Close()

if resp.StatusCode == 200 {
// FIXME move this to a test, and run go tests as part of our regression
if false {
// this is because schema is wrong, defaults to type `int`, so we manually change it
// to `string`. If the jiradata is regenerated we need to manually make the change
// again.
log.Debugf("Assert Attachment.ID is a string, rather than int: %v", &jiradata.Attachment{
ID: jiradata.IntOrString(0),
})
}
results := jiradata.ListOfAttachment{}
return &results, readJSON(resp.Body, &results)
}
Expand Down
15 changes: 15 additions & 0 deletions jiradata/Attachment_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package jiradata

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestAttachmentID(t *testing.T) {
// this is because schema is wrong, defaults to type `int`, so we manually change it
// to `string`. If the jiradata is regenerated we need to manually make the change
// again to include:
// ID IntOrString `json:"id,omitempty" yaml:"id,omitempty"`
assert.IsType(t, IntOrString(0), Attachment{}.ID)
}

0 comments on commit 41d1a7c

Please sign in to comment.