def test_publish_with_name(self, id_generator, args, engine, create_tag_info_mock): args.action = "publish" args.no_cleanup = False args.name = id_generator() with mock.patch('flowhub.core.do_hook') as patch: def input_func(query_str): return "" handle_release_call(args, engine, input_func=input_func) patch.assert_has_calls([ mock.call(args, engine, "pre-release-publish"), mock.call().__nonzero__(), # the if check mock.call(args, engine, "post-release-publish", mock.ANY), ]) engine.assert_has_calls([ mock.call.publish_release( name=args.name, with_delete=not args.no_cleanup, tag_info=create_tag_info_mock.return_value, ), ]) create_tag_info_mock.assert_called_once_with( args, input_func, engine.release.name.replace.return_value, )
def test_contribute(self, args, engine): args.action = "contribute" handle_release_call(args, engine) engine.assert_has_calls([ mock.call.contribute_release(), ])
def test_start(self, id_generator, args, engine): args.action = "start" args.name = id_generator() with mock.patch("flowhub.core.do_hook") as patch: handle_release_call(args, engine) patch.assert_has_calls([mock.call(args, engine, "post-release-start", args.name)]) engine.assert_has_calls([mock.call.start_release(name=args.name)])
def test_publish_failed_hook(self, id_generator, args, engine): args.action = "publish" args.name = id_generator() with mock.patch("flowhub.core.do_hook") as patch: patch.return_value = False handle_release_call(args, engine) patch.assert_has_calls([mock.call(args, engine, "pre-release-publish")]) assert engine.call_count == 0