/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_memorybranch.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-28 01:15:49 UTC
  • mto: (7490.40.78 work)
  • mto: This revision was merged to the branch mainline in revision 7520.
  • Revision ID: jelmer@jelmer.uk-20200728011549-cm0b9k1wa9wudxme
Add a MemoryBranch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2020 Jelmer Vernooij
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
 
 
17
from . import TestCaseWithTransport
 
18
 
 
19
from ..memorybranch import MemoryBranch
 
20
 
 
21
 
 
22
class MemoryBranchTests(TestCaseWithTransport):
 
23
 
 
24
    def setUp(self):
 
25
        super(MemoryBranchTests, self).setUp()
 
26
        self.tree = self.make_branch_and_tree('.')
 
27
        self.revid1 = self.tree.commit('rev1')
 
28
        self.revid2 = self.tree.commit('rev2')
 
29
        self.branch = MemoryBranch(
 
30
            self.tree.branch.repository, (2, self.revid2))
 
31
 
 
32
    def test_last_revision_info(self):
 
33
        self.assertEqual((2, self.revid2), self.branch.last_revision_info())
 
34
 
 
35
    def test_last_revision(self):
 
36
        self.assertEqual(self.revid2, self.branch.last_revision())
 
37
 
 
38
    def test_revno(self):
 
39
        self.assertEqual(2, self.branch.revno())
 
40
 
 
41
    def test_get_rev_id(self):
 
42
        self.assertEqual(self.revid1, self.branch.get_rev_id(1))
 
43
 
 
44
    def test_revision_id_to_revno(self):
 
45
        self.assertEqual(2, self.branch.revision_id_to_revno(self.revid2))
 
46
        self.assertEqual(1, self.branch.revision_id_to_revno(self.revid1))