~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-12 00:28:59 UTC
  • mto: This revision was merged to the branch mainline in revision 4122.
  • Revision ID: john@arbash-meinel.com-20090312002859-ay54agwgzxpyt9zx
Move the 'add_lines_nostoresha' to being tested against all VF implementations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1493
1493
            trailing_eol=trailing_eol, nograph=not self.graph,
1494
1494
            left_only=left_only)
1495
1495
 
 
1496
    def test_add_lines_nostoresha(self):
 
1497
        """When nostore_sha is supplied using old content raises."""
 
1498
        vf = self.get_versionedfiles()
 
1499
        empty_text = ('a', [])
 
1500
        sample_text_nl = ('b', ["foo\n", "bar\n"])
 
1501
        sample_text_no_nl = ('c', ["foo\n", "bar"])
 
1502
        shas = []
 
1503
        for version, lines in (empty_text, sample_text_nl, sample_text_no_nl):
 
1504
            sha, _, _ = vf.add_lines(self.get_simple_key(version), [], lines)
 
1505
            shas.append(sha)
 
1506
        # we now have a copy of all the lines in the vf.
 
1507
        for sha, (version, lines) in zip(
 
1508
            shas, (empty_text, sample_text_nl, sample_text_no_nl)):
 
1509
            new_key = self.get_simple_key(version + "2")
 
1510
            self.assertRaises(errors.ExistingContent,
 
1511
                vf.add_lines, new_key, [], lines,
 
1512
                nostore_sha=sha)
 
1513
            # and no new version should have been added.
 
1514
            record = vf.get_record_stream([new_key], 'unordered', True).next()
 
1515
            self.assertEqual('absent', record.storage_kind)
 
1516
 
1496
1517
    def test_add_lines_return(self):
1497
1518
        files = self.get_versionedfiles()
1498
1519
        # save code by using the stock data insertion helper.