Skip to content
Snippets Groups Projects

Better error compliance and comparison tests refactor

Merged Georges Racinet requested to merge topic/stable/blob-tree-comparison into branch/stable
13 files
+ 655
405
Compare changes
  • Side-by-side
  • Inline
Files
13
@@ -806,12 +806,13 @@
assert 'bigger than the maximum allowed size (5)' in err_details
# revision or file not found
resp = rpc_single_response(b'not/there')
assert not resp.data
assert not resp.oid
resp = rpc_single_response(b'foo', revision=b'branch/unknown')
assert not resp.data
assert not resp.oid
with pytest.raises(grpc.RpcError) as exc_info:
do_rpc(b'not/there')
assert exc_info.value.code() == grpc.StatusCode.NOT_FOUND
with pytest.raises(grpc.RpcError) as exc_info:
do_rpc(b'foo', revision=b'branch/unknown')
assert exc_info.value.code() == grpc.StatusCode.NOT_FOUND
# with obsolescence
wrapper.command('amend', message=b'amended')
@@ -821,6 +822,23 @@
assert resp.mode == 0o100644
assert resp.type == TreeEntryResponse.ObjectType.BLOB
# chunking
thirty_two = b'ba' * 16384
for content_suffix in (b'', b'x'):
content = thirty_two + content_suffix
rev_hex = wrapper.commit_file(b'bar', content).hex()
resps = do_rpc(b'bar', revision=rev_hex)
assert len(resps) == 3 if content_suffix else 2
# metadata are carried by the first response only
assert resps[0].type == TreeEntryResponse.ObjectType.BLOB
assert resps[0].mode == 0o100644
for r in resps[1:]:
assert not r.type
assert not r.mode
assert b''.join(r.data for r in resps) == content
def test_get_tree_entries(commit_fixture_empty_repo):
fixture = commit_fixture_empty_repo
Loading