MCPcopy Create free account
hub / github.com/gitless-vcs/gitless / TestBranch

Class TestBranch

gitless/tests/test_e2e.py:272–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270
271
272class TestBranch(TestEndToEnd):
273
274 BRANCH_1 = 'branch1'
275 BRANCH_2 = 'branch2'
276
277 def setUp(self):
278 super(TestBranch, self).setUp()
279 utils.write_file('f')
280 gl.commit('f', m='commit')
281
282 def test_create(self):
283 gl.branch(c=self.BRANCH_1)
284 self.assertRaises(ErrorReturnCode, gl.branch, c=self.BRANCH_1)
285 self.assertRaises(ErrorReturnCode, gl.branch, c='evil*named*branch')
286 if self.BRANCH_1 not in utils.stdout(gl.branch()):
287 self.fail()
288
289 def test_remove(self):
290 gl.branch(c=self.BRANCH_1)
291 gl.switch(self.BRANCH_1)
292 self.assertRaises(ErrorReturnCode, gl.branch, d=self.BRANCH_1, _in='y')
293 gl.branch(c=self.BRANCH_2)
294 gl.switch(self.BRANCH_2)
295 gl.branch(d=self.BRANCH_1, _in='n')
296 gl.branch(d=self.BRANCH_1, _in='y')
297 if self.BRANCH_1 in utils.stdout(gl.branch()):
298 self.fail()
299
300 def test_upstream(self):
301 self.assertRaises(ErrorReturnCode, gl.branch, '-uu')
302 self.assertRaises(ErrorReturnCode, gl.branch, '-su', 'non-existent')
303 self.assertRaises(
304 ErrorReturnCode, gl.branch, '-su', 'non-existent/non-existent')
305
306 def test_list(self):
307 gl.branch(c=self.BRANCH_1)
308 gl.branch(c=self.BRANCH_2)
309 branch_out = utils.stdout(gl.branch())
310 self.assertTrue(
311 branch_out.find(self.BRANCH_1) < branch_out.find(self.BRANCH_2))
312
313
314class TestTag(TestEndToEnd):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected