def test_history_not_pulled(self, lib): # Depending on tree traversal depth, the entire commit # hierarchy may not have been pulled. commit_id = '123' parents = ['456', '789', None] variants = [ (True, ({ 'version': 1 }, )), (True, ({ 'version': 2 }, )), GError, ] _repo = Mock() _repo.load_variant.side_effect = variants _lib = Mock() _lib.OSTree.Repo.new.return_value = _repo _lib.GLib.GError = GError _lib.OSTree.ObjectType.COMMIT = 'COMMIT' _lib.OSTree.commit_get_parent.side_effect = parents lib.return_value = _lib # test repo = Repository('') history = repo.history(commit_id) # validation self.assertEqual(history, [ Commit('123', {'version': 1}), Commit('456', {'version': 2}), ])
def test_history(self, lib): commit_id = '123' parents = ['456', '789', None] variants = [ (True, ({ 'version': 1 }, )), (True, ({ 'version': 2 }, )), (True, ({ 'version': 3 }, )), ] _repo = Mock() _repo.load_variant.side_effect = variants _lib = Mock() _lib.OSTree.Repo.new.return_value = _repo _lib.GLib.GError = GError _lib.OSTree.ObjectType.COMMIT = 'COMMIT' _lib.OSTree.commit_get_parent.side_effect = parents lib.return_value = _lib # test repo = Repository('') history = repo.history(commit_id) # validation self.assertEqual(history, [ Commit('123', {'version': 1}), Commit('456', {'version': 2}), Commit('789', {'version': 3}), ])