v.io/jiri@v0.0.0-20160715023856-abfb8b131290/gerrit/test_helpers.go (about) 1 // Copyright 2016 The Vanadium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package gerrit 6 7 import ( 8 "fmt" 9 ) 10 11 func GenCL(clNumber, patchset int, project string) Change { 12 return GenCLWithMoreData(clNumber, patchset, project, PresubmitTestTypeAll, "vj@google.com") 13 } 14 15 func GenCLWithMoreData(clNumber, patchset int, project string, presubmit PresubmitTestType, ownerEmail string) Change { 16 change := Change{ 17 Current_revision: "r", 18 Revisions: Revisions{ 19 "r": Revision{ 20 Fetch: Fetch{ 21 Http: Http{ 22 Ref: fmt.Sprintf("refs/changes/xx/%d/%d", clNumber, patchset), 23 }, 24 }, 25 }, 26 }, 27 Project: project, 28 Change_id: "", 29 PresubmitTest: presubmit, 30 Owner: Owner{ 31 Email: ownerEmail, 32 }, 33 } 34 return change 35 } 36 37 func GenMultiPartCL(clNumber, patchset int, project, topic string, index, total int) Change { 38 return GenMultiPartCLWithMoreData(clNumber, patchset, project, topic, index, total, "vj@google.com") 39 } 40 41 func GenMultiPartCLWithMoreData(clNumber, patchset int, project, topic string, index, total int, ownerEmail string) Change { 42 return Change{ 43 Current_revision: "r", 44 Revisions: Revisions{ 45 "r": Revision{ 46 Fetch: Fetch{ 47 Http: Http{ 48 Ref: fmt.Sprintf("refs/changes/xx/%d/%d", clNumber, patchset), 49 }, 50 }, 51 }, 52 }, 53 Project: project, 54 Change_id: "", 55 Owner: Owner{ 56 Email: ownerEmail, 57 }, 58 MultiPart: &MultiPartCLInfo{ 59 Topic: topic, 60 Index: index, 61 Total: total, 62 }, 63 } 64 }