Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
rickardl authored Oct 20, 2020
2 parents 9ff47d2 + 2ab0f31 commit 9c40cd3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions in_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ func TestGet(t *testing.T) {
PR: "pr1",
Commit: "commit1",
CommittedDate: time.Time{},
ApprovedReviewCount: 0,
ApprovedReviewCount: "0",
},
parameters: resource.GetParameters{},
pullRequest: createTestPR(1, "master", false, false, 0, nil),
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":0}`,
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0"}`,
metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"[email protected]"}]`,
},
{
Expand All @@ -56,11 +56,11 @@ func TestGet(t *testing.T) {
PR: "pr1",
Commit: "commit1",
CommittedDate: time.Time{},
ApprovedReviewCount: 0,
ApprovedReviewCount: "0",
},
parameters: resource.GetParameters{},
pullRequest: createTestPR(1, "master", false, false, 0, nil),
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":0}`,
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0"}`,
metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"[email protected]"}]`,
},
{
Expand All @@ -73,13 +73,13 @@ func TestGet(t *testing.T) {
PR: "pr1",
Commit: "commit1",
CommittedDate: time.Time{},
ApprovedReviewCount: 0,
ApprovedReviewCount: "0",
},
parameters: resource.GetParameters{
IntegrationTool: "rebase",
},
pullRequest: createTestPR(1, "master", false, false, 0, nil),
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":0}`,
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0"}`,
metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"[email protected]"}]`,
},
{
Expand All @@ -92,13 +92,13 @@ func TestGet(t *testing.T) {
PR: "pr1",
Commit: "commit1",
CommittedDate: time.Time{},
ApprovedReviewCount: 0,
ApprovedReviewCount: "0",
},
parameters: resource.GetParameters{
IntegrationTool: "checkout",
},
pullRequest: createTestPR(1, "master", false, false, 0, nil),
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":0}`,
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0"}`,
metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"[email protected]"}]`,
},
{
Expand All @@ -111,13 +111,13 @@ func TestGet(t *testing.T) {
PR: "pr1",
Commit: "commit1",
CommittedDate: time.Time{},
ApprovedReviewCount: 0,
ApprovedReviewCount: "0",
},
parameters: resource.GetParameters{
GitDepth: 2,
},
pullRequest: createTestPR(1, "master", false, false, 0, nil),
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":0}`,
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0"}`,
metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"[email protected]"}]`,
},
{
Expand All @@ -130,7 +130,7 @@ func TestGet(t *testing.T) {
PR: "pr1",
Commit: "commit1",
CommittedDate: time.Time{},
ApprovedReviewCount: 0,
ApprovedReviewCount: "0",
},
parameters: resource.GetParameters{
ListChangedFiles: true,
Expand All @@ -144,7 +144,7 @@ func TestGet(t *testing.T) {
Path: "Other.md",
},
},
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":0}`,
versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0"}`,
metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"[email protected]"}]`,
filesString: "README.md\nOther.md\n",
},
Expand Down
4 changes: 2 additions & 2 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type Version struct {
PR string `json:"pr"`
Commit string `json:"commit"`
CommittedDate time.Time `json:"committed,omitempty"`
ApprovedReviewCount int `json:"approved_review_count"`
ApprovedReviewCount string `json:"approved_review_count"`
}

// NewVersion constructs a new Version.
Expand All @@ -70,7 +70,7 @@ func NewVersion(p *PullRequest) Version {
PR: strconv.Itoa(p.Number),
Commit: p.Tip.OID,
CommittedDate: p.Tip.CommittedDate.Time,
ApprovedReviewCount: p.ApprovedReviewCount,
ApprovedReviewCount: strconv.Itoa(p.ApprovedReviewCount),
}
}

Expand Down

0 comments on commit 9c40cd3

Please sign in to comment.