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

  • Committer: Jelmer Vernooij
  • Date: 2009-03-19 16:43:56 UTC
  • mto: (0.436.139 foreign)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090319164356-iwxw3x3ntre7fjxc
Fix formatting.

Show diffs side-by-side

added added

removed removed

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