~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

Test versioned file storage handling of clean/dirty status for accessed versioned files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
380
380
        self.assertEquals(('base', 'line\n'), origins[0])
381
381
        self.assertEquals(('base', 'line_b\n'), origins[1])
382
382
        self.assertEquals(('references_ghost', 'line_c\n'), origins[2])
 
383
 
 
384
    def test_readonly_mode(self):
 
385
        transport = get_transport(self.get_url('.'))
 
386
        factory = self.get_factory()
 
387
        vf = factory('id', transport, 0777, create=True, access_mode='w')
 
388
        vf = factory('id', transport, access_mode='r')
 
389
        self.assertRaises(errors.ReadOnlyError, vf.add_lines, 'base', [], [])
 
390
        self.assertRaises(errors.ReadOnlyError,
 
391
                          vf.add_lines_with_ghosts,
 
392
                          'base',
 
393
                          [],
 
394
                          [])
 
395
        self.assertRaises(errors.ReadOnlyError, vf.fix_parents, 'base', [])
 
396
        self.assertRaises(errors.ReadOnlyError, vf.join, 'base')
383
397
        
384
398
 
385
399
class TestWeave(TestCaseWithTransport, VersionedFileTestMixIn):
430
444
                          'foo',
431
445
                          get_transport(self.get_url('.')))
432
446
 
 
447
    def get_factory(self):
 
448
        return WeaveFile
 
449
 
433
450
 
434
451
class TestKnit(TestCaseWithTransport, VersionedFileTestMixIn):
435
452
 
437
454
        return KnitVersionedFile(name, get_transport(self.get_url('.')),
438
455
                                 delta=True, create=True)
439
456
 
 
457
    def get_factory(self):
 
458
        return KnitVersionedFile
 
459
 
440
460
    def get_file_corrupted_text(self):
441
461
        knit = self.get_file()
442
462
        knit.add_lines('v1', [], ['hello\n'])