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

Class TestFuse

gitless/tests/test_e2e.py:445–646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443
444
445class TestFuse(TestOp):
446
447 def __assert_history(self, expected):
448 out = utils.stdout(gl.history())
449 cids = list(reversed(re.findall(r'ci (.*) in (\S*)', out, re.UNICODE)))
450 self.assertItemsEqual(
451 cids, expected, 'cids is ' + text(cids) + ' exp ' + text(expected))
452
453 st_out = utils.stdout(gl.status())
454 self.assertFalse('fuse' in st_out)
455
456 def __build(self, branch_name, cids=None):
457 if not cids:
458 cids = range(self.COMMITS_NUMBER)
459 return [(text(ci), branch_name) for ci in cids]
460
461 def test_basic(self):
462 gl.fuse(self.OTHER)
463 self.__assert_history(self.__build(self.OTHER) + self.__build('master'))
464
465 def test_only_errors(self):
466 self.assertRaises(ErrorReturnCode, gl.fuse, self.OTHER, o='non-existent-id')
467 self.assertRaises(
468 ErrorReturnCode, gl.fuse, self.OTHER, o=self.commits['master'][1])
469
470 def test_only_one(self):
471 gl.fuse(self.OTHER, o=self.commits[self.OTHER][0])
472 self.__assert_history(
473 self.__build(self.OTHER, cids=[0]) + self.__build('master'))
474
475 def test_only_some(self):
476 gl.fuse(self.OTHER, '-o', self.commits[self.OTHER][:2])
477 self.__assert_history(
478 self.__build(self.OTHER, [0, 1]) + self.__build('master'))
479
480 def test_exclude_errors(self):
481 self.assertRaises(ErrorReturnCode, gl.fuse, self.OTHER, e='non-existent-id')
482 self.assertRaises(
483 ErrorReturnCode, gl.fuse, self.OTHER, e=self.commits['master'][1])
484
485 def test_exclude_one(self):
486 last_ci = self.COMMITS_NUMBER - 1
487 gl.fuse(self.OTHER, e=self.commits[self.OTHER][last_ci])
488 self.__assert_history(
489 self.__build(self.OTHER, range(0, last_ci)) + self.__build('master'))
490
491 def test_exclude_some(self):
492 gl.fuse(self.OTHER, '-e', self.commits[self.OTHER][1:])
493 self.__assert_history(
494 self.__build(self.OTHER, cids=[0]) + self.__build('master'))
495
496 def test_ip_dp(self):
497 gl.fuse(self.OTHER, insertion_point='dp')
498 self.__assert_history(self.__build(self.OTHER) + self.__build('master'))
499
500 def test_ip_head(self):
501 gl.fuse(self.OTHER, insertion_point='HEAD')
502 self.__assert_history(self.__build('master') + self.__build(self.OTHER))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected