Example #1
0
def test_loop(mock_upstream_remote_functionality, github_release_fedmsg):
    def mocked_iter_releases():
        msg = copy.deepcopy(github_release_fedmsg)
        yield msg["topic"], msg

    flexmock(Consumerino, iterate_releases=mocked_iter_releases)
    conf = get_test_config()
    api = PackitBotAPI(conf)
    api.watch_upstream_release()
Example #2
0
def test_loop(mock_remote_functionality_upstream, github_release_fedmsg):
    u, d = mock_remote_functionality_upstream

    def mocked_iter_releases():
        msg = copy.deepcopy(github_release_fedmsg)
        yield msg["topic"], msg

    flexmock(Repo).should_receive("clone_from").and_return(git.Repo(str(u)))
    flexmock(Consumerino, iterate_releases=mocked_iter_releases)
    conf = get_test_config()
    api = PackitBotAPI(conf)
    api.watch_upstream_release()
def watch_releases(config, message_id):
    """
    watch for activity on github and for every new upstream release, create a
    downstream pull request

    if MESSAGE-ID is specified, process only the selected fedmsg
    """
    api = PackitBotAPI(config)
    if message_id:
        for msg_id in message_id:
            fedmsg_dict = api.consumerino.fetch_fedmsg_dict(msg_id)
            api.sync_upstream_release_with_fedmsg(fedmsg_dict)
    else:
        api.watch_upstream_release()