bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.205.5
by Jelmer Vernooij
Import virtual versionedfiles code. |
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.tests import TestCase |
|
18 |
||
19 |
from versionedfiles import (VirtualRevisionTexts, VirtualInventoryTexts, |
|
20 |
VirtualSignatureTexts) |
|
21 |
||
22 |
||
23 |
class BasicTextsTests: |
|
24 |
def test_add_lines(self): |
|
25 |
self.assertRaises(NotImplementedError, |
|
26 |
self.texts.add_lines, "foo", [], []) |
|
27 |
||
28 |
def test_add_mpdiffs(self): |
|
29 |
self.assertRaises(NotImplementedError, |
|
30 |
self.texts.add_mpdiffs, []) |
|
31 |
||
32 |
def test_check(self): |
|
33 |
self.assertTrue(self.texts.check()) |
|
34 |
||
35 |
def test_insert_record_stream(self): |
|
36 |
self.assertRaises(NotImplementedError, self.texts.insert_record_stream, |
|
37 |
[])
|
|
38 |
||
39 |
||
40 |
class VirtualRevisionTextsTests(TestCase, BasicTextsTests): |
|
41 |
def _make_parents_provider(self): |
|
42 |
return self |
|
43 |
||
44 |
def setUp(self): |
|
45 |
self.texts = VirtualRevisionTexts(self) |
|
46 |
||
47 |
def get_parent_map(self, keys): |
|
48 |
raise NotImplementedError |
|
49 |
||
50 |
||
51 |
class VirtualInventoryTextsTests(TestCase, BasicTextsTests): |
|
52 |
def _make_parents_provider(self): |
|
53 |
return self |
|
54 |
||
55 |
def get_inventory_xml(self, key): |
|
56 |
return "FOO" |
|
57 |
||
58 |
def get_parent_map(self, keys): |
|
59 |
return {("A",): (("B",))} |
|
60 |
||
61 |
def setUp(self): |
|
62 |
self.texts = VirtualInventoryTexts(self) |
|
63 |
||
64 |
def test_get_sha1s(self): |
|
65 |
self.assertEquals({("A",): osutils.sha_strings(["FOO"])}, self.texts.get_sha1s([("A",)])) |
|
66 |
||
67 |
||
68 |
class VirtualSignatureTextsTests(TestCase, BasicTextsTests): |
|
69 |
def _make_parents_provider(self): |
|
70 |
return self |
|
71 |
||
72 |
def setUp(self): |
|
73 |
self.texts = VirtualSignatureTexts(self) |
|
74 |
||
75 |
def get_parent_map(self, keys): |
|
76 |
raise NotImplementedError |
|
77 |