@freeze_time("2015-03-16")
def test_run_harvester_calls(monkeypatch):
    mock_harvest = mock.MagicMock()
    mock_begin_norm = mock.MagicMock()

    monkeypatch.setattr('scrapi.tasks.harvest', mock_harvest)
    monkeypatch.setattr('scrapi.tasks.begin_normalization', mock_begin_norm)

    tasks.run_harvester('test')

    assert mock_harvest.si.called
    assert mock_begin_norm.s.called
    end_date = date(2015, 3, 16)
    start_date = end_date - timedelta(settings.DAYS_BACK)

    mock_begin_norm.s.assert_called_once_with('test')
    mock_harvest.si.assert_called_once_with('test', 'TIME', start_date=start_date, end_date=end_date)
dataset/ETHPy150Open CenterForOpenScience/scrapi/tests/test_tasks.py/test_run_harvester_calls/original