From 1f1f850cd2b64b32b7b3809435589b67413568b3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 05 2021 16:55:30 +0000 Subject: Do not enforce the presence of the initialqacontact field In addition, we cannot send None/null values, so use empty string, ie: "" when we want to reset that field. Signed-off-by: Pierre-Yves Chibon --- diff --git a/tests/utils/test_bugzilla_system.py b/tests/utils/test_bugzilla_system.py index b87b60e..9654624 100644 --- a/tests/utils/test_bugzilla_system.py +++ b/tests/utils/test_bugzilla_system.py @@ -863,7 +863,7 @@ class TestEditComponent: ) mock_bz.assert_called_with() - data["initialqacontact"] = None + data["initialqacontact"] = "" server.editcomponent.assert_called_with(data=data) mock_set_pkg_owner.assert_called_with( new_poc=owner, diff --git a/toddlers/utils/bugzilla_system.py b/toddlers/utils/bugzilla_system.py index dd22ab2..93130fb 100644 --- a/toddlers/utils/bugzilla_system.py +++ b/toddlers/utils/bugzilla_system.py @@ -312,11 +312,12 @@ def add_component( "component": package, "description": description or "NA", "initialowner": owner, - "initialqacontact": qa_contact, "is_active": not retired, } if cc_list: data["initialcclist"] = cc_list + if qa_contact: + data["initialqacontact"] = qa_contact for key in [ "initialowner", @@ -354,7 +355,7 @@ def add_component( ) else: _log.info( - "[ADDCOMP] %s/%s %s set to `%s`", product, package, key, data[key] + "[ADDCOMP] %s/%s %s set to `%s`", product, package, key, data.get(key) ) if not dry_run: @@ -430,7 +431,7 @@ def edit_component( data["initialqacontact"] = qa_contact # Be explicit about removing the qacontact from Fedora components elif qa_contact is None: - data["initialqacontact"] = qa_contact + data["initialqacontact"] = "" if len(component["initialcclist"]) != len(cc_list): data["initialcclist"] = cc_list