From ecf350a780662e68d4c94ee7c89556a7c78c7ed1 Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Sep 06 2021 11:40:45 +0000 Subject: [protonmsg] convert btypes to json string fixes: #3017 --- diff --git a/plugins/hub/protonmsg.py b/plugins/hub/protonmsg.py index 1198c25..1e17d11 100644 --- a/plugins/hub/protonmsg.py +++ b/plugins/hub/protonmsg.py @@ -216,7 +216,7 @@ def prep_build_state_change(cbtype, *args, **kws): 'name': kws['info']['name'], 'version': kws['info']['version'], 'release': kws['info']['release'], - 'btypes': btypeinfo, + 'btypes': json.dumps(btypeinfo, default=json_serialize), 'attribute': kws['attribute'], 'old': old, 'new': new} diff --git a/tests/test_plugins/test_protonmsg.py b/tests/test_plugins/test_protonmsg.py index 6e2f3bc..6fc7780 100644 --- a/tests/test_plugins/test_protonmsg.py +++ b/tests/test_plugins/test_protonmsg.py @@ -1,5 +1,6 @@ from __future__ import absolute_import +import json import tempfile import unittest @@ -132,7 +133,7 @@ extra_limit = 2048 assert_info = {'name': 'test-pkg', 'version': '1.0', 'release': '1', - 'btypes': {'image': {'build_id': 1}}} + 'btypes': json.dumps({'image': {'build_id': 1}})} self.get_build_type.return_value = {'image': {'build_id': 1}} protonmsg.prep_build_state_change('postBuildStateChange', info=info, attribute='volume_id', @@ -155,7 +156,7 @@ extra_limit = 2048 assert_info = {'name': 'test-pkg', 'version': '1.0', 'release': '1', - 'btypes': {}} + 'btypes': '{}'} self.get_build_type.return_value = {} protonmsg.prep_build_state_change('postBuildStateChange', info=info, attribute='volume_id',