/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 tests/test_versionedfiles.py

Merge foreign branch utility code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
 
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 3 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
from bzrlib import osutils
 
17
from bzrlib.graph import DictParentsProvider
 
18
from bzrlib.tests import TestCase
 
19
 
 
20
from bzrlib.plugins.git.versionedfiles import (SvnTexts, VirtualRevisionTexts, 
 
21
                                               VirtualInventoryTexts, VirtualSignatureTexts)
 
22
 
 
23
 
 
24
class BasicSvnTextsTests:
 
25
    def test_add_lines(self):
 
26
        self.assertRaises(NotImplementedError, 
 
27
                self.texts.add_lines, "foo", [], [])
 
28
 
 
29
    def test_add_mpdiffs(self):
 
30
        self.assertRaises(NotImplementedError, 
 
31
                self.texts.add_mpdiffs, [])
 
32
 
 
33
    def test_check(self):
 
34
        self.assertTrue(self.texts.check())
 
35
 
 
36
    def test_insert_record_stream(self):
 
37
        self.assertRaises(NotImplementedError, self.texts.insert_record_stream,
 
38
                          [])
 
39
 
 
40
 
 
41
class SvnTextsTests(TestCase,BasicSvnTextsTests):
 
42
    def setUp(self):
 
43
        self.texts = SvnTexts(self)
 
44
 
 
45
 
 
46
class VirtualRevisionTextsTests(TestCase,BasicSvnTextsTests):
 
47
    def _make_parents_provider(self):
 
48
        return self
 
49
 
 
50
    def setUp(self):
 
51
        self.texts = VirtualRevisionTexts(self)
 
52
 
 
53
    def get_parent_map(self, keys):
 
54
        raise NotImplementedError
 
55
 
 
56
 
 
57
class VirtualInventoryTextsTests(TestCase,BasicSvnTextsTests):
 
58
    def _make_parents_provider(self):
 
59
        return self
 
60
 
 
61
    def get_inventory_xml(self, key):
 
62
        return "FOO"
 
63
 
 
64
    def get_parent_map(self, keys):
 
65
        return {("A",): (("B",))}
 
66
 
 
67
    def setUp(self):
 
68
        self.texts = VirtualInventoryTexts(self)
 
69
 
 
70
    def test_get_sha1s(self):
 
71
        self.assertEquals({("A",): osutils.sha_strings(["FOO"])}, self.texts.get_sha1s([("A",)]))
 
72
 
 
73
 
 
74
class VirtualSignatureTextsTests(TestCase,BasicSvnTextsTests):
 
75
    def _make_parents_provider(self):
 
76
        return self
 
77
 
 
78
    def setUp(self):
 
79
        self.texts = VirtualSignatureTexts(self)
 
80
 
 
81
    def get_parent_map(self, keys):
 
82
        raise NotImplementedError
 
83