From 783a180f637b692560abe6a29ecfd45c36f90c12 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 12 2020 16:16:15 +0000 Subject: Replace the call to tagHistory to a call to queryHistory Koji has deprecated the tagHistory method in favor of the queryHistory one. This commit attempts to port the code from the deprecated method to the new one using as an example the changes made in the upstream PR: https://pagure.io/koji/pull-request/938 Fixes https://pagure.io/robosignatory/issue/47 Signed-off-by: Pierre-Yves Chibon --- diff --git a/robosignatory/tag.py b/robosignatory/tag.py index f801924..d277af3 100644 --- a/robosignatory/tag.py +++ b/robosignatory/tag.py @@ -155,13 +155,13 @@ class TagSigner(object): # Verify that the build was tagged into the tag by one of the # trusted taggers. - for hist_event in sorted(instance['client'].tagHistory(build_id), + for hist_event in sorted(instance['client'].queryHistory(build=build_id)['tag_listing'], key=lambda ev: ev['create_ts'], reverse=True): # We want to verify the latest matching tagging event only. if ( hist_event['active'] - and hist_event['tag_name'] == tag + and hist_event['tag.name'] == tag ): if hist_event['creator_name'] in sidetag_matched['trusted_taggers']: # This is how it should be, break out of the loop. diff --git a/tests/test_tag.py b/tests/test_tag.py index 164f439..e66baef 100644 --- a/tests/test_tag.py +++ b/tests/test_tag.py @@ -275,15 +275,17 @@ class TestTagSigner(object): tagger = 'bodhi' if error == 'missing-from-history': - tag_history = [] + tag_history = {'tag_listing': []} else: - tag_history = [ - {'active': True, - 'create_ts': 1554076800, - 'creator_name': tagger, - 'tag_name': sidetag_pending}, - ] - self.koji_client.tagHistory.return_value = tag_history + tag_history = {'tag_listing': + [ + {'active': True, + 'create_ts': 1554076800, + 'creator_name': tagger, + 'tag.name': sidetag_pending}, + ] + } + self.koji_client.queryHistory.return_value = tag_history return tag_conf, tagger