checkupdates: remove duplicate push in push_commits()

This commit is contained in:
Hans-Christoph Steiner 2024-10-30 23:50:06 +01:00
parent 17c480d299
commit 20ff302e89
2 changed files with 5 additions and 4 deletions

View file

@ -739,9 +739,6 @@ def push_commits(remote_name='origin', branch_name='checkupdates', verbose=False
git_repo.create_head(branch_name, force=True)
remote = git_repo.remotes[remote_name]
pushinfos = remote.push(
branch_name, force=True, set_upstream=True, progress=progress
)
pushinfos = remote.push(
branch_name,
progress=progress,

View file

@ -464,10 +464,13 @@ class CheckupdatesTest(unittest.TestCase):
self.assertTrue(branch in ('main', 'master'))
self.assertTrue(branch in repo.heads)
@mock.patch('git.remote.Remote.push')
@mock.patch('sys.exit')
@mock.patch('fdroidserver.common.read_app_args')
@mock.patch('fdroidserver.checkupdates.checkupdates_app')
def test_merge_requests_branch(self, checkupdates_app, read_app_args, sys_exit):
def test_merge_requests_branch(
self, checkupdates_app, read_app_args, sys_exit, push
):
def _sys_exit(return_code=0):
self.assertEqual(return_code, 0)
@ -499,5 +502,6 @@ class CheckupdatesTest(unittest.TestCase):
self.assertNotIn(appid, git_repo.heads)
with mock.patch('sys.argv', ['fdroid checkupdates', '--merge-request', appid]):
fdroidserver.checkupdates.main()
push.assert_called_once()
sys_exit.assert_called_once()
self.assertIn(appid, git_repo.heads)