@@ -26,14 +26,14 @@ import (
2626 scut "github.com/ossf/scorecard/v5/utests"
2727)
2828
29- func getBranchName (branch * clients.BranchRef ) string {
29+ func getBranchName (branch * clients.RepoRef ) string {
3030 if branch == nil || branch .Name == nil {
3131 return ""
3232 }
3333 return * branch .Name
3434}
3535
36- func getBranch (branches []* clients.BranchRef , name string , isNonAdmin bool ) * clients.BranchRef {
36+ func getBranch (branches []* clients.RepoRef , name string , isNonAdmin bool ) * clients.RepoRef {
3737 for _ , branch := range branches {
3838 branchName := getBranchName (branch )
3939 if branchName == name {
@@ -46,9 +46,9 @@ func getBranch(branches []*clients.BranchRef, name string, isNonAdmin bool) *cli
4646 return nil
4747}
4848
49- func scrubBranch (branch * clients.BranchRef ) * clients.BranchRef {
49+ func scrubBranch (branch * clients.RepoRef ) * clients.RepoRef {
5050 ret := branch
51- ret .BranchProtectionRule = clients.BranchProtectionRule {}
51+ ret .ProtectionRule = clients.ProtectionRule {}
5252 return ret
5353}
5454
@@ -67,7 +67,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
6767 tests := []struct {
6868 name string
6969 defaultBranch string
70- branches []* clients.BranchRef
70+ branches []* clients.RepoRef
7171 releases []string
7272 repoFiles []string
7373 expected scut.TestReturn
@@ -83,10 +83,10 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
8383 NumberOfDebug : 0 ,
8484 },
8585 defaultBranch : main ,
86- branches : []* clients.BranchRef {
86+ branches : []* clients.RepoRef {
8787 {
8888 Protected : & trueVal ,
89- BranchProtectionRule : clients.BranchProtectionRule {
89+ ProtectionRule : clients.ProtectionRule {
9090 CheckRules : clients.StatusChecksRule {
9191 RequiresStatusChecks : & trueVal ,
9292 UpToDateBeforeMerge : & trueVal ,
@@ -106,7 +106,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
106106 },
107107 {
108108 Protected : & trueVal ,
109- BranchProtectionRule : clients.BranchProtectionRule {
109+ ProtectionRule : clients.ProtectionRule {
110110 CheckRules : clients.StatusChecksRule {
111111 RequiresStatusChecks : & trueVal ,
112112 UpToDateBeforeMerge : & falseVal ,
@@ -138,15 +138,15 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
138138 NumberOfDebug : 0 ,
139139 },
140140 defaultBranch : main ,
141- branches : []* clients.BranchRef {
141+ branches : []* clients.RepoRef {
142142 {
143143 Name : & rel1 ,
144144 Protected : & falseVal ,
145145 },
146146 {
147147 Name : & main ,
148148 Protected : & trueVal ,
149- BranchProtectionRule : clients.BranchProtectionRule {
149+ ProtectionRule : clients.ProtectionRule {
150150 CheckRules : clients.StatusChecksRule {
151151 RequiresStatusChecks : & trueVal ,
152152 UpToDateBeforeMerge : & falseVal ,
@@ -178,11 +178,11 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
178178 NumberOfDebug : 0 ,
179179 },
180180 defaultBranch : main ,
181- branches : []* clients.BranchRef {
181+ branches : []* clients.RepoRef {
182182 {
183183 Name : & main ,
184184 Protected : & trueVal ,
185- BranchProtectionRule : clients.BranchProtectionRule {
185+ ProtectionRule : clients.ProtectionRule {
186186 CheckRules : clients.StatusChecksRule {
187187 RequiresStatusChecks : & trueVal ,
188188 UpToDateBeforeMerge : & trueVal ,
@@ -204,7 +204,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
204204 {
205205 Name : & rel1 ,
206206 Protected : & trueVal ,
207- BranchProtectionRule : clients.BranchProtectionRule {
207+ ProtectionRule : clients.ProtectionRule {
208208 CheckRules : clients.StatusChecksRule {
209209 RequiresStatusChecks : & trueVal ,
210210 UpToDateBeforeMerge : & falseVal ,
@@ -236,11 +236,11 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
236236 NumberOfDebug : 0 ,
237237 },
238238 defaultBranch : main ,
239- branches : []* clients.BranchRef {
239+ branches : []* clients.RepoRef {
240240 {
241241 Name : & main ,
242242 Protected : & trueVal ,
243- BranchProtectionRule : clients.BranchProtectionRule {
243+ ProtectionRule : clients.ProtectionRule {
244244 CheckRules : clients.StatusChecksRule {
245245 RequiresStatusChecks : & trueVal ,
246246 UpToDateBeforeMerge : & trueVal ,
@@ -262,7 +262,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
262262 {
263263 Name : & rel1 ,
264264 Protected : & trueVal ,
265- BranchProtectionRule : clients.BranchProtectionRule {
265+ ProtectionRule : clients.ProtectionRule {
266266 CheckRules : clients.StatusChecksRule {
267267 RequiresStatusChecks : & trueVal ,
268268 UpToDateBeforeMerge : & trueVal ,
@@ -295,11 +295,11 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
295295 },
296296 defaultBranch : main ,
297297 releases : []string {sha },
298- branches : []* clients.BranchRef {
298+ branches : []* clients.RepoRef {
299299 {
300300 Name : & main ,
301301 Protected : & trueVal ,
302- BranchProtectionRule : clients.BranchProtectionRule {
302+ ProtectionRule : clients.ProtectionRule {
303303 CheckRules : clients.StatusChecksRule {
304304 RequiresStatusChecks : & trueVal ,
305305 UpToDateBeforeMerge : & falseVal ,
@@ -334,11 +334,11 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
334334 },
335335 defaultBranch : main ,
336336 releases : []string {"" },
337- branches : []* clients.BranchRef {
337+ branches : []* clients.RepoRef {
338338 {
339339 Name : & main ,
340340 Protected : & trueVal ,
341- BranchProtectionRule : clients.BranchProtectionRule {
341+ ProtectionRule : clients.ProtectionRule {
342342 CheckRules : clients.StatusChecksRule {
343343 RequiresStatusChecks : & trueVal ,
344344 UpToDateBeforeMerge : & falseVal ,
@@ -371,11 +371,11 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
371371 defaultBranch : main ,
372372 // branches: []*string{&rel1, &main},
373373 releases : []string {rel1 },
374- branches : []* clients.BranchRef {
374+ branches : []* clients.RepoRef {
375375 {
376376 Name : & main ,
377377 Protected : & trueVal ,
378- BranchProtectionRule : clients.BranchProtectionRule {
378+ ProtectionRule : clients.ProtectionRule {
379379 CheckRules : clients.StatusChecksRule {
380380 RequiresStatusChecks : & trueVal ,
381381 UpToDateBeforeMerge : & trueVal ,
@@ -386,7 +386,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
386386 {
387387 Name : & rel1 ,
388388 Protected : & trueVal ,
389- BranchProtectionRule : clients.BranchProtectionRule {
389+ ProtectionRule : clients.ProtectionRule {
390390 CheckRules : clients.StatusChecksRule {
391391 RequiresStatusChecks : & trueVal ,
392392 UpToDateBeforeMerge : & trueVal ,
@@ -405,7 +405,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
405405 ctrl := gomock .NewController (t )
406406 mockRepoClient := mockrepo .NewMockRepoClient (ctrl )
407407 mockRepoClient .EXPECT ().GetDefaultBranch ().
408- DoAndReturn (func () (* clients.BranchRef , error ) {
408+ DoAndReturn (func () (* clients.RepoRef , error ) {
409409 defaultBranch := getBranch (tt .branches , tt .defaultBranch , tt .nonadmin )
410410 return defaultBranch , nil
411411 }).AnyTimes ()
@@ -420,7 +420,7 @@ func TestReleaseAndDevBranchProtected(t *testing.T) {
420420 return ret , nil
421421 }).AnyTimes ()
422422 mockRepoClient .EXPECT ().GetBranch (gomock .Any ()).
423- DoAndReturn (func (b string ) (* clients.BranchRef , error ) {
423+ DoAndReturn (func (b string ) (* clients.RepoRef , error ) {
424424 return getBranch (tt .branches , b , tt .nonadmin ), nil
425425 }).AnyTimes ()
426426 mockRepoClient .EXPECT ().ListFiles (gomock .Any ()).AnyTimes ().Return (tt .repoFiles , nil )
0 commit comments