1429
1429
def test_get_sha1s(self):
1430
# sha1's in the test knit are answered without asking the basis
1431
basis, test = self.get_basis_and_test_knit()
1433
key_basis = ('bar',)
1434
key_missing = ('missing',)
1435
test.add_lines(key, (), ['foo\n'])
1436
key_sha1sum = sha.new('foo\n').hexdigest()
1437
sha1s = test.get_sha1s([key])
1438
self.assertEqual({key: key_sha1sum}, sha1s)
1439
self.assertEqual([], basis.calls)
1440
# But texts that are not in the test knit are looked for in the basis
1441
# directly (rather than via text reconstruction) so that remote servers
1442
# etc don't have to answer with full content.
1443
basis.add_lines(key_basis, (), ['foo\n', 'bar\n'])
1444
basis_sha1sum = sha.new('foo\nbar\n').hexdigest()
1446
sha1s = test.get_sha1s([key, key_missing, key_basis])
1447
self.assertEqual({key: key_sha1sum,
1448
key_basis: basis_sha1sum}, sha1s)
1449
self.assertEqual([("get_sha1s", set([key_basis, key_missing]))],
1432
1452
def test_insert_record_stream(self):