예제 #1
0
    def engine(self, git, repository_structure, configurator, feature_manager, release_manager, hotfix_manager, pull_manager, github):
        with mock.patch('flowhub.engine.getpass'):
            engine = Engine(init=True, input_func=lambda s: "")

        engine.setup_repository_structure(
            **repository_structure
        )

        # setup the configurator mock
        for key in ["name", "origin", "canon", "master", "develop"]:
            setattr(
                configurator().flowhub.structure,
                key,
                repository_structure[key]
            )
        for key in ["feature", "release", "hotfix"]:
            setattr(
                configurator().flowhub.prefix,
                key,
                repository_structure[key]
            )

        engine = Engine()
        feature_manager.assert_has_calls([
            mock.call(
                debug=engine.DEBUG,
                prefix=repository_structure['feature'],
                origin=mock.ANY,
                canon=mock.ANY,
                master=mock.ANY,
                develop=mock.ANY,
                release=mock.ANY,
                hotfix=mock.ANY,
                repo=mock.ANY,
                gh=github(),
                offline=False
            ),
        ])

        release_manager.assert_has_calls([
            mock.call(
                debug=engine.DEBUG,
                prefix=repository_structure['release'],
                origin=mock.ANY,
                canon=mock.ANY,
                master=mock.ANY,
                develop=mock.ANY,
                release=mock.ANY,
                hotfix=mock.ANY,
                repo=mock.ANY,
                gh=github(),
                offline=False
            ),
        ])

        hotfix_manager.assert_has_calls([
            mock.call(
                debug=engine.DEBUG,
                prefix=repository_structure['hotfix'],
                origin=mock.ANY,
                canon=mock.ANY,
                master=mock.ANY,
                develop=mock.ANY,
                release=mock.ANY,
                hotfix=mock.ANY,
                repo=mock.ANY,
                gh=github(),
                offline=False
            ),
        ])

        pull_manager.assert_has_calls([
            mock.call(
                debug=engine.DEBUG,
                prefix=repository_structure['name'],
                origin=mock.ANY,
                canon=mock.ANY,
                master=mock.ANY,
                develop=mock.ANY,
                release=mock.ANY,
                hotfix=mock.ANY,
                repo=mock.ANY,
                gh=github(),
                offline=False
            ),
        ])

        return engine
예제 #2
0
    def engine(self, git, repository_structure, feature_manager, hotfix_manager, pull_manager, release_manager, configurator):
        engine = Engine(init=True, offline=True)


        engine.setup_repository_structure(
            **repository_structure
        )

        # setup the configurator mock
        for key in ["name", "origin", "canon", "master", "develop"]:
            setattr(
                configurator.return_value.flowhub.structure,
                key,
                repository_structure[key]
            )
        for key in ["feature", "release", "hotfix"]:
            setattr(
                configurator.return_value.flowhub.prefix,
                key,
                repository_structure[key]
            )

        engine = Engine(offline=True)
        feature_manager.assert_has_calls([
            mock.call(
                debug=engine.DEBUG,
                prefix=repository_structure['feature'],
                origin=mock.ANY,
                canon=mock.ANY,
                master=mock.ANY,
                develop=mock.ANY,
                release=mock.ANY,
                hotfix=mock.ANY,
                repo=mock.ANY,
                gh=None,
                offline=True
            ),
        ])

        release_manager.assert_has_calls([
            mock.call(
                debug=engine.DEBUG,
                prefix=repository_structure['release'],
                origin=mock.ANY,
                canon=mock.ANY,
                master=mock.ANY,
                develop=mock.ANY,
                release=mock.ANY,
                hotfix=mock.ANY,
                repo=mock.ANY,
                gh=None,
                offline=True
            ),
        ])

        hotfix_manager.assert_has_calls([
            mock.call(
                debug=engine.DEBUG,
                prefix=repository_structure['hotfix'],
                origin=mock.ANY,
                canon=mock.ANY,
                master=mock.ANY,
                develop=mock.ANY,
                release=mock.ANY,
                hotfix=mock.ANY,
                repo=mock.ANY,
                gh=None,
                offline=True
            ),
        ])

        pull_manager.assert_has_calls([
            mock.call(
                debug=engine.DEBUG,
                prefix=repository_structure['name'],
                origin=mock.ANY,
                canon=mock.ANY,
                master=mock.ANY,
                develop=mock.ANY,
                release=mock.ANY,
                hotfix=mock.ANY,
                repo=mock.ANY,
                gh=None,
                offline=True
            ),
        ])

        return engine