Skip to content

Commit 55eb70f

Browse files
authored
Add Author attribute for test mocks (#856)
1 parent 96bd3dd commit 55eb70f

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/golang/mock v1.6.0
88
github.com/google/go-github/v45 v45.2.0
99
github.com/jfrog/build-info-go v1.10.10
10-
github.com/jfrog/froggit-go v1.16.2
10+
github.com/jfrog/froggit-go v1.17.0
1111
github.com/jfrog/gofrog v1.7.6
1212
github.com/jfrog/jfrog-cli-artifactory v0.2.1
1313
github.com/jfrog/jfrog-cli-core/v2 v2.58.2
@@ -127,4 +127,4 @@ replace github.com/jfrog/jfrog-cli-security => github.com/jfrog/jfrog-cli-securi
127127

128128
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250402063549-14e8fd119680
129129

130-
// replace github.com/jfrog/froggit-go => github.com/jfrog/froggit-go dev
130+
// replace github.com/jfrog/froggit-go => github.com/jfrog/froggit-go master

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5
124124
github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw=
125125
github.com/jfrog/build-info-go v1.10.10 h1:2nOFjV7SX1uisi2rQK7fb4Evm7YkSOdmssrm6Tf4ipc=
126126
github.com/jfrog/build-info-go v1.10.10/go.mod h1:JcISnovFXKx3wWf3p1fcMmlPdt6adxScXvoJN4WXqIE=
127-
github.com/jfrog/froggit-go v1.16.2 h1:F//S83iXH14qsCwYzv0zB2JtjS2pJVEsUoEmYA+37dQ=
128-
github.com/jfrog/froggit-go v1.16.2/go.mod h1:5VpdQfAcbuyFl9x/x8HGm7kVk719kEtW/8YJFvKcHPA=
127+
github.com/jfrog/froggit-go v1.17.0 h1:20Ie787WO27SwB2MOHDvsR6yN7fA5WfRnuAbmUqz1Zs=
128+
github.com/jfrog/froggit-go v1.17.0/go.mod h1:HvDkfFfJwIdsXFdqaB+utvD2cLDRmaC3kF8otYb6Chw=
129129
github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s=
130130
github.com/jfrog/gofrog v1.7.6/go.mod h1:ntr1txqNOZtHplmaNd7rS4f8jpA5Apx8em70oYEe7+4=
131131
github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY=

scanpullrequest/scanallpullrequests_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func getMockClient(t *testing.T, frogbotMessages *[]string, mockParams ...MockPa
215215
sourceBranchInfo := vcsclient.BranchInfo{Name: params.sourceBranchName, Repository: params.repoName, Owner: params.repoOwner}
216216
targetBranchInfo := vcsclient.BranchInfo{Name: params.targetBranchName, Repository: params.repoName, Owner: params.repoOwner}
217217
// Return 2 pull requests to scan, the first with issues the second "clean".
218-
client.EXPECT().ListOpenPullRequests(context.Background(), params.repoOwner, params.repoName).Return([]vcsclient.PullRequestInfo{{ID: 1, Source: sourceBranchInfo, Target: targetBranchInfo}, {ID: 2, Source: targetBranchInfo, Target: targetBranchInfo}}, nil)
218+
client.EXPECT().ListOpenPullRequests(context.Background(), params.repoOwner, params.repoName).Return([]vcsclient.PullRequestInfo{{ID: 1, Source: sourceBranchInfo, Target: targetBranchInfo, Author: "a"}, {ID: 2, Source: targetBranchInfo, Target: targetBranchInfo, Author: "a"}}, nil)
219219
// Return empty comments slice so expect the code to scan both pull requests.
220220
client.EXPECT().ListPullRequestComments(context.Background(), params.repoOwner, params.repoName, gomock.Any()).Return([]vcsclient.CommentInfo{}, nil).AnyTimes()
221221
client.EXPECT().ListPullRequestReviewComments(context.Background(), params.repoOwner, params.repoName, gomock.Any()).Return([]vcsclient.CommentInfo{}, nil).AnyTimes()

scanrepository/scanrepository_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ pr body
260260
[comment]: <> (Checksum: 01373ac4d2c32e7da9be22f3e4b4e665)
261261
pr body
262262
`
263+
userLogin := "user"
263264
tests := []struct {
264265
testName string
265266
expectedUpdate bool
@@ -278,6 +279,7 @@ pr body
278279
Label: &targetLabel,
279280
Repo: &github.Repository{Name: &targetBranchName, Owner: &github.User{}},
280281
},
282+
User: &github.User{Login: &userLogin},
281283
Body: &firstBody,
282284
}},
283285
},
@@ -294,6 +296,7 @@ pr body
294296
Label: &targetLabel,
295297
Repo: &github.Repository{Name: &targetBranchName, Owner: &github.User{}},
296298
},
299+
User: &github.User{Login: &userLogin},
297300
Body: &secondBody,
298301
}},
299302
},

testdata/scanpullrequest/expectedPullRequestDetailsResponse.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
"description": "this is pr description",
77
"state": "opened",
88
"target_branch": "master",
9-
"source_branch": "pr"
9+
"source_branch": "pr",
10+
"author": {
11+
"username": "testuser"
12+
}
1013
}

0 commit comments

Comments
 (0)