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

Add docstring.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
class TestGitShaMap:
34
34
 
35
35
    def test_commit(self):
36
 
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301", 
 
36
        self.map.start_write_group()
 
37
        self.map._add_entry("5686645d49063c73d35436192dfc9a160c672301",
37
38
            "commit", ("myrevid", "cc9462f7f8263ef5adfbeff2fb936bb36b504cba"))
 
39
        self.map.commit_write_group()
38
40
        self.assertEquals(
39
41
            ("commit", ("myrevid", "cc9462f7f8263ef5adfbeff2fb936bb36b504cba")),
40
42
            self.map.lookup_git_sha("5686645d49063c73d35436192dfc9a160c672301"))
41
43
 
42
44
    def test_lookup_notfound(self):
43
 
        self.assertRaises(KeyError, 
 
45
        self.assertRaises(KeyError,
44
46
            self.map.lookup_git_sha, "5686645d49063c73d35436192dfc9a160c672301")
45
 
        
 
47
 
46
48
    def test_blob(self):
47
49
        thesha = "5686645d49063c73d35436192dfc9a160c672301"
48
 
        self.map.add_entry(thesha, "blob", ("myfileid", "myrevid"))
 
50
        self.map.start_write_group()
 
51
        self.map._add_entry(thesha, "blob", ("myfileid", "myrevid"))
 
52
        self.map.commit_write_group()
49
53
        self.assertEquals(
50
54
            ("blob", ("myfileid", "myrevid")),
51
55
            self.map.lookup_git_sha(thesha))
52
 
        self.assertEquals(thesha, self.map.lookup_blob("myfileid", "myrevid"))
 
56
        invshamap = self.map.get_inventory_sha_map("myrevid")
 
57
        self.assertEquals(thesha, invshamap.lookup_blob("myfileid"))
53
58
 
54
59
    def test_tree(self):
55
60
        thesha = "5686645d49063c73d35436192dfc9a160c672301"
56
 
        self.map.add_entry(thesha, 
 
61
        self.map.start_write_group()
 
62
        self.map._add_entry(thesha,
57
63
            "tree", ("somepath", "myrevid"))
 
64
        self.map.commit_write_group()
58
65
        self.assertEquals(
59
66
            ("tree", ("somepath", "myrevid")),
60
67
            self.map.lookup_git_sha(thesha))
61
 
        self.assertEquals(thesha, self.map.lookup_tree("somepath", "myrevid"))
62
68
 
63
69
    def test_revids(self):
64
 
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301", 
 
70
        self.map.start_write_group()
 
71
        self.map._add_entry("5686645d49063c73d35436192dfc9a160c672301",
65
72
            "commit", ("myrevid", "cc9462f7f8263ef5adfbeff2fb936bb36b504cba"))
 
73
        self.map.commit_write_group()
66
74
        self.assertEquals(["myrevid"], list(self.map.revids()))
67
75
 
 
76
    def test_missing_revisions(self):
 
77
        self.map.start_write_group()
 
78
        self.map._add_entry("5686645d49063c73d35436192dfc9a160c672301",
 
79
            "commit", ("myrevid", "cc9462f7f8263ef5adfbeff2fb936bb36b504cba"))
 
80
        self.map.commit_write_group()
 
81
        self.assertEquals(set(["lala", "bla"]),
 
82
            set(self.map.missing_revisions(["myrevid", "lala", "bla"])))
 
83
 
68
84
 
69
85
class DictGitShaMapTests(TestCase,TestGitShaMap):
70
86