Dulwich.io dulwich / 47409db
Fix tests. Jelmer Vernooń≥ 15 days ago
2 changed file(s) with 24 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
550550 else:
551551 proto.write_pkt_line(
552552 old_sha1 + b' ' + new_sha1 + b' ' + refname + b'\0' +
553 b' '.join(capabilities))
553 b' '.join(sorted(capabilities)))
554554 sent_capabilities = True
555555 if new_sha1 not in have and new_sha1 != ZERO_SHA:
556556 want.append(new_sha1)
630630 """
631631 assert isinstance(wants, list) and isinstance(wants[0], bytes)
632632 proto.write_pkt_line(COMMAND_WANT + b' ' + wants[0] + b' ' +
633 b' '.join(capabilities) + b'\n')
633 b' '.join(sorted(capabilities)) + b'\n')
634634 for want in wants[1:]:
635635 proto.write_pkt_line(COMMAND_WANT + b' ' + want + b'\n')
636636 if depth not in (0, None) or getattr(graph_walker, 'shallow', None):
137137 b'thin-pack', b'multi_ack_detailed', b'shallow',
138138 agent_cap]),
139139 set(self.client._fetch_capabilities))
140 self.assertEqual(set([b'ofs-delta', b'report-status', b'side-band-64k',
141 agent_cap]),
142 set(self.client._send_capabilities))
140 self.assertEqual(
141 set(
142 [b'delete-refs', b'ofs-delta', b'report-status', b'side-band-64k',
143 agent_cap]),
144 set(self.client._send_capabilities))
143145
144146 def test_archive_ack(self):
145147 self.rin.write(
265267 return 0, []
266268
267269 self.client.send_pack(b'/', update_refs, generate_pack_data)
268 self.assertIn(
270 self.assertEqual(
269271 self.rout.getvalue(),
270 [b'007f310ca9477129b8586fa2afc779c1f57cf64bba6c '
271 b'0000000000000000000000000000000000000000 '
272 b'refs/heads/master\x00report-status ofs-delta0000',
273 b'007f310ca9477129b8586fa2afc779c1f57cf64bba6c '
274 b'0000000000000000000000000000000000000000 '
275 b'refs/heads/master\x00ofs-delta report-status0000'])
272 b'008b310ca9477129b8586fa2afc779c1f57cf64bba6c '
273 b'0000000000000000000000000000000000000000 '
274 b'refs/heads/master\x00delete-refs ofs-delta report-status0000')
276275
277276 def test_send_pack_delete_only(self):
278277 self.rin.write(
290289 return 0, []
291290
292291 self.client.send_pack(b'/', update_refs, generate_pack_data)
293 self.assertIn(
292 self.assertEqual(
294293 self.rout.getvalue(),
295 [b'007f310ca9477129b8586fa2afc779c1f57cf64bba6c '
296 b'0000000000000000000000000000000000000000 '
297 b'refs/heads/master\x00report-status ofs-delta0000',
298 b'007f310ca9477129b8586fa2afc779c1f57cf64bba6c '
299 b'0000000000000000000000000000000000000000 '
300 b'refs/heads/master\x00ofs-delta report-status0000'])
294 b'008b310ca9477129b8586fa2afc779c1f57cf64bba6c '
295 b'0000000000000000000000000000000000000000 '
296 b'refs/heads/master\x00delete-refs ofs-delta report-status0000')
301297
302298 def test_send_pack_new_ref_only(self):
303299 self.rin.write(
322318 f = BytesIO()
323319 write_pack_objects(f, {})
324320 self.client.send_pack('/', update_refs, generate_pack_data)
325 self.assertIn(
321 self.assertEqual(
326322 self.rout.getvalue(),
327 [b'007f0000000000000000000000000000000000000000 '
328 b'310ca9477129b8586fa2afc779c1f57cf64bba6c '
329 b'refs/heads/blah12\x00report-status ofs-delta0000' +
330 f.getvalue(),
331 b'007f0000000000000000000000000000000000000000 '
332 b'310ca9477129b8586fa2afc779c1f57cf64bba6c '
333 b'refs/heads/blah12\x00ofs-delta report-status0000' +
334 f.getvalue()])
323 b'008b0000000000000000000000000000000000000000 '
324 b'310ca9477129b8586fa2afc779c1f57cf64bba6c '
325 b'refs/heads/blah12\x00delete-refs ofs-delta report-status0000' +
326 f.getvalue())
335327
336328 def test_send_pack_new_ref(self):
337329 self.rin.write(
365357 f = BytesIO()
366358 write_pack_data(f, *generate_pack_data(None, None))
367359 self.client.send_pack(b'/', update_refs, generate_pack_data)
368 self.assertIn(
360 self.assertEqual(
369361 self.rout.getvalue(),
370 [b'007f0000000000000000000000000000000000000000 ' + commit.id +
371 b' refs/heads/blah12\x00report-status ofs-delta0000' +
372 f.getvalue(),
373 b'007f0000000000000000000000000000000000000000 ' + commit.id +
374 b' refs/heads/blah12\x00ofs-delta report-status0000' +
375 f.getvalue()])
362 b'008b0000000000000000000000000000000000000000 ' + commit.id +
363 b' refs/heads/blah12\x00delete-refs ofs-delta report-status0000' +
364 f.getvalue())
376365
377366 def test_send_pack_no_deleteref_delete_only(self):
378367 pkts = [b'310ca9477129b8586fa2afc779c1f57cf64bba6c refs/heads/master'