def testSetGitShallowClone(self):
self.executeBobJenkinsCmd("set-options -o scm.git.shallow=42 myTestJenkins")
self.executeBobJenkinsCmd("push -q myTestJenkins")
send = self.jenkinsMock.getServerData()
config = ElementTree.fromstring(send[0][1])
for clone in config.iter('hudson.plugins.git.extensions.impl.CloneOption'):
found = 0
for a in clone.getiterator():
if a.tag == 'shallow':
assert(a.text == 'true')
found += 1
if a.tag == 'depth':
assert(a.text == '42')
found += 1
assert(found == 2)
self.executeBobJenkinsCmd("set-options -o scm.git.shallow=-1 myTestJenkins")
with self.assertRaises(Exception) as c:
self.executeBobJenkinsCmd("push -q myTestJenkins")
assert(type(c.exception) == BuildError)
评论列表
文章目录