Пример #1
0
def invoke():
    """
    * Reads in pages all connected & active data-pipes from the DB
    * Each read page of data-pipes is sent to the web_fetcher service
    in a REST call
    """
    logging.info("Invoking data-pipes...")
    count = 0
    criteria = {"type": PERSONAL_TWITTER_FEED}
    for page in load_data_pipes(criteria=criteria):
        count += web_fetcher.pull_from_data_pipes(page)
    return "{} posts fetched..".format(count)
def test_load_data_pipes(get_db):
    db = MagicMock()
    get_db.return_value = db
    data_pipe_spec = {'status': 'active', 'connectedBldg': {'$exists': True}}
    for page in load_data_pipes():
        db.data_pipes.find.assert_called_once_with(data_pipe_spec, skip=0, limit=100)