@@ -245,6 +245,23 @@ def test_try_api_success_hgexport(
245245 worker = LandingWorker (sleep_seconds = 0.01 )
246246 hgrepo = HgRepo (hg_clone .strpath )
247247
248+ assert len (job .revisions ) == 1 , "Job should be landing a single revision."
249+ revision = job .revisions [0 ]
250+ assert revision .patch_bytes == (
251+ b"# HG changeset patch\n "
252+ b"# User Test User <test@example.com>\n "
253+ b"# Date 0 +0000\n "
254+ b"# Diff Start Line 6\n "
255+ b"add another file.\n "
256+ b"\n "
257+ b"diff --git a/test.txt b/test.txt\n "
258+ b"--- a/test.txt\n "
259+ b"+++ b/test.txt\n "
260+ b"@@ -1,1 +1,2 @@\n "
261+ b" TEST\n "
262+ b"+adding another line"
263+ ), "Patch diff should be parsed from patch body."
264+
248265 assert worker .run_job (job , repo , hgrepo , treestatus )
249266 assert job .status == LandingJobStatus .LANDED
250267 assert len (job .landed_commit_id ) == 40
@@ -267,20 +284,7 @@ def test_try_api_success_hgexport(
267284 assert (
268285 revision .patch_data ["timestamp" ] == "0"
269286 ), "Timestamp should be parsed from `Date` header."
270- assert revision .patch_bytes == (
271- b"# HG changeset patch\n "
272- b"# User Test User <test@example.com>\n "
273- b"# Date 0 +0000\n "
274- b"# Diff Start Line 6\n "
275- b"add another file.\n "
276- b"\n "
277- b"diff --git a/test.txt b/test.txt\n "
278- b"--- a/test.txt\n "
279- b"+++ b/test.txt\n "
280- b"@@ -1,1 +1,2 @@\n "
281- b" TEST\n "
282- b"+adding another line"
283- ), "Patch diff should be parsed from patch body."
287+ assert revision .patch_bytes == b"" , "Patch diff should be cleared after landing."
284288
285289
286290def test_try_api_success_gitformatpatch (
@@ -334,6 +338,26 @@ def test_try_api_success_gitformatpatch(
334338 worker = LandingWorker (sleep_seconds = 0.01 )
335339 hgrepo = HgRepo (hg_clone .strpath )
336340
341+ assert len (job .revisions ) == 1 , "Job should be landing a single revision."
342+ revision = job .revisions [0 ]
343+
344+ assert revision .patch_bytes == (
345+ b"# HG changeset patch\n "
346+ b"# User Connor Sheehan <sheehan@mozilla.com>\n "
347+ b"# Date 1657139769 +0000\n "
348+ b"# Diff Start Line 8\n "
349+ b"add another file\n "
350+ b"\n "
351+ b"add another file to the repo.\n "
352+ b"\n "
353+ b"diff --git a/test.txt b/test.txt\n "
354+ b"--- a/test.txt\n "
355+ b"+++ b/test.txt\n "
356+ b"@@ -1,1 +1,2 @@\n "
357+ b" TEST\n "
358+ b"+adding another line"
359+ ), "Patch diff should be parsed from patch body."
360+
337361 # Assert the job landed against the expected commit hash.
338362 assert worker .run_job (job , repo , hgrepo , treestatus )
339363 assert job .status == LandingJobStatus .LANDED
@@ -343,8 +367,6 @@ def test_try_api_success_gitformatpatch(
343367 ), "Target changeset should match the passed value."
344368
345369 # Test the revision content matches expected.
346- assert len (job .revisions ) == 1 , "Job should have landed a single revision."
347- revision = job .revisions [0 ]
348370 assert (
349371 revision .patch_data ["author_name" ] == "Connor Sheehan"
350372 ), "Patch author should be parsed from `From` header."
@@ -357,19 +379,4 @@ def test_try_api_success_gitformatpatch(
357379 assert (
358380 revision .patch_data ["timestamp" ] == "1657139769"
359381 ), "Timestamp should be parsed from `Date` header."
360- assert revision .patch_bytes == (
361- b"# HG changeset patch\n "
362- b"# User Connor Sheehan <sheehan@mozilla.com>\n "
363- b"# Date 1657139769 +0000\n "
364- b"# Diff Start Line 8\n "
365- b"add another file\n "
366- b"\n "
367- b"add another file to the repo.\n "
368- b"\n "
369- b"diff --git a/test.txt b/test.txt\n "
370- b"--- a/test.txt\n "
371- b"+++ b/test.txt\n "
372- b"@@ -1,1 +1,2 @@\n "
373- b" TEST\n "
374- b"+adding another line"
375- ), "Patch diff should be parsed from patch body."
382+ assert revision .patch_bytes == b"" , "Patch diff should be cleared after landing."
0 commit comments