def test_prep_build_state_change_with_empty_build_type(self): info = {'name': 'test-pkg', 'version': '1.0', 'release': '1', 'build_id': 1} assert_info = {'name': 'test-pkg', 'version': '1.0', 'release': '1'} msg_body = { 'info': info.copy(), 'btypes': {}, 'attribute': 'state', 'old': 0, 'new': 1, } self.get_build_type.return_value = {} protonmsg.prep_build_state_change('postBuildStateChange', info=info, attribute='volume_id', old=0, new=1) # no messages should be created for callbacks where attribute != state self.assertFalse(hasattr(context, 'protonmsg_msgs')) self.get_build_type.return_value = {} protonmsg.prep_build_state_change('postBuildStateChange', info=info, attribute='state', old=0, new=1) self.assertMsg('build.complete', type='BuildStateChange', attribute='state', old='BUILDING', new='COMPLETE', body=msg_body, **assert_info)
def test_prep_build_state_change(self): info = {'name': 'test-pkg', 'version': '1.0', 'release': '1'} protonmsg.prep_build_state_change('postBuildStateChange', info=info, attribute='volume_id', old=0, new=1) # no messages should be created for callbacks where attribute != state self.assertFalse(hasattr(context, 'protonmsg_msgs')) protonmsg.prep_build_state_change('postBuildStateChange', info=info, attribute='state', old=0, new=1) self.assertMsg('build.complete', type='BuildStateChange', attribute='state', old='BUILDING', new='COMPLETE', **info)