Example #1
0
    def test_publish_with_name(self, id_generator, args, engine, create_tag_info_mock):
        args.action = "publish"
        args.name = id_generator()
        args.issue_numbers = []
        with mock.patch('flowhub.core.do_hook') as patch:
            patch.return_value = True

            def input_func(query_str):
                return ""

            handle_hotfix_call(
                args,
                engine,
                input_func=input_func
            )

            patch.assert_has_calls([
                mock.call(args, engine, 'pre-hotfix-publish'),
                mock.call(args, engine, 'post-hotfix-publish', mock.ANY),

            ])

            engine.assert_has_calls([
                mock.call.publish_hotfix(
                    name=args.name,
                    tag_info=create_tag_info_mock.return_value,
                ),
            ])

            create_tag_info_mock.assert_called_once_with(
                args,
                input_func,
                engine.hotfix.name.replace.return_value,
            )
Example #2
0
    def test_start(self, id_generator, args, engine):
        args.action = "start"
        args.name = id_generator()
        args.issue_numbers = []

        with mock.patch('flowhub.core.do_hook') as patch:
            patch.return_value = True

            handle_hotfix_call(args, engine)

            patch.assert_has_calls([
                mock.call(
                    args,
                    engine,
                    "post-hotfix-start",
                    args.name,
                ),
            ])

            engine.assert_has_calls([
                mock.call.start_hotfix(
                    name=args.name,
                    issues=args.issue_numbers
                )
            ])
Example #3
0
    def test_contribute(self, args, engine):
        args.action = "contribute"

        handle_hotfix_call(args, engine)

        engine.assert_has_calls([
            mock.call.contribute_hotfix(),
        ])