From 9909549c795bb902e6d9d0ea1949ea22fd684b49 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Mon, 29 Jul 2019 11:48:21 +0200 Subject: [PATCH] Bug 1569545 - Added tests for submitting a patch when a user-defined bookmark is present Reviewers: zalun Reviewed By: zalun Subscribers: zalun Bug #: 1569545 Differential Revision: https://phabricator.services.mozilla.com/D39653 --- tests/test_integration-hg.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/test_integration-hg.py b/tests/test_integration-hg.py index ccf4cc9..343238d 100644 --- a/tests/test_integration-hg.py +++ b/tests/test_integration-hg.py @@ -39,6 +39,33 @@ def test_submit_create(in_process, hg_repo_path): """ assert log.strip() == expected.strip() + assert hg_out("bookmark").strip() == "no bookmarks set" + + +def test_submit_create_with_user_bookmark(in_process, hg_repo_path): + call_conduit.reset_mock() + call_conduit.side_effect = ({}, [{"userName": "alice", "phid": "PHID-USER-1"}]) + + testfile = hg_repo_path / "X" + testfile.write_text(u"a") + hg_out("add") + hg_out("commit", "--message", "A r?alice") + + user_bookmark_name = "user_bookmark" + hg_out("bookmark", user_bookmark_name) + + mozphab.main(["submit", "--yes", "--bug", "1"]) + + log = hg_out("log", "--template", r"{desc}\n", "--rev", ".") + expected = """ +Bug 1 - A r?alice + +Differential Revision: http://example.test/D123 +""" + assert log.strip() == expected.strip() + + assert hg_out("bookmark").startswith(" * " + user_bookmark_name) + def test_submit_update(in_process, hg_repo_path): call_conduit.reset_mock()