Skip to content

Commit

Permalink
dist-git: fix test_do_import test
Browse files Browse the repository at this point in the history
The 'has_calls" actually never worked - it was a typo which had a no-op
effect - and with the Python 3.12 in Fedora 39+ it finally started
failing.

Let's switch to a valid 'assert_has_calls' and update the expected
output (which is a bit artificial after the years, but it doesn't
matter).

Relates: #2811
  • Loading branch information
praiskup committed Aug 2, 2023
1 parent 81e1815 commit 7ccf442
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions dist-git/tests/test_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ def test_do_import(self, mc_import_package, mc_helpers):
assert mc_import_package.call_args[0][2] == self.url_task.branches
assert mc_import_package.call_args[0][3] == 'somepath.src.rpm'

print(self.importer.post_back_safe.has_calls([
mock.call({'build_id': 125, 'pkg_name': 'foo', 'branch': self.BRANCH,
'pkg_version': '1.2', 'git_hash': '123', 'repo_name': 'foo'}),
mock.call({'build_id': 125, 'pkg_name': 'foo', 'branch': self.BRANCH2,
'pkg_version': '1.2', 'git_hash': '124', 'repo_name': 'foo'})
]))
self.importer.post_back_safe.assert_has_calls([
mock.call({
'build_id': 123,
'pkg_name': 'foo',
'pkg_evr': '1.2',
'reponame': 'foo',
'branch_commits': {'f22': '123', 'f23': '124'}}),
])


@mock.patch("copr_dist_git.import_dispatcher.Importer", return_value=MagicMock())
Expand Down

0 comments on commit 7ccf442

Please sign in to comment.