/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
7490.78.1 by Jelmer Vernooij
Fix marks file handling on Python 3.
1
# Copyright (C) 2020 Canonical Ltd
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, see <http://www.gnu.org/licenses/>.
15
16
"""Test the marks file methods."""
17
18
from __future__ import absolute_import
19
20
from .... import tests
21
22
from .. import marks_file
23
24
25
class TestMarksFile(tests.TestCaseWithTransport):
26
27
    def test_read(self):
28
        self.build_tree_contents([('marks', """\
29
:1 jelmer@jelmer-rev1
30
:2 joe@example.com-rev2
31
""")])
32
        self.assertEqual({
33
            b'1': b'jelmer@jelmer-rev1',
34
            b'2': b'joe@example.com-rev2',
35
            }, marks_file.import_marks('marks'))
36
37
    def test_write(self):
38
        marks_file.export_marks('marks', {
39
            b'1': b'jelmer@jelmer-rev1',
40
            b'2': b'joe@example.com-rev2',
41
            })
42
        self.assertFileEqual("""\
43
:1 jelmer@jelmer-rev1
44
:2 joe@example.com-rev2
45
""", 'marks')