Exemple #1
0
def test_harvest_raises(harvester):
    harvester.harvest.side_effect = KeyError("testing")

    with pytest.raises(KeyError) as e:
        tasks.harvest("test", "TIME")

    assert e.value.message == "testing"
Exemple #2
0
def test_harvest_raises(harvester):
    harvester.harvest.side_effect = KeyError('testing')

    with pytest.raises(KeyError) as e:
        tasks.harvest('test', 'TIME')

    assert e.value.message == 'testing'
Exemple #3
0
def test_harvest_raises(harvester):
    harvester.harvest.side_effect = KeyError('testing')

    with pytest.raises(KeyError) as e:
        tasks.harvest('test', 'TIME')

    assert e.value.message == 'testing'
Exemple #4
0
def test_harvest_raises(harvester):
    harvester.harvest.side_effect = KeyError('testing')

    with pytest.raises(KeyError) as e:
        tasks.harvest('test', 'TIME')

    # no .message in Python3
    assert e.value.args[0] == 'testing'
Exemple #5
0
def test_harvest_raises(harvester):
    harvester.harvest.side_effect = KeyError('testing')

    with pytest.raises(KeyError) as e:
        tasks.harvest('test', 'TIME')

    # no .message in Python3
    assert e.value.args[0] == 'testing'
Exemple #6
0
def test_harvest_days_back(harvester):
    _, timestamps = tasks.harvest('test', 'TIME', days_back=10)

    keys = ['harvestFinished', 'harvestTaskCreated', 'harvestStarted']

    for key in keys:
        assert key in timestamps.keys()

    assert harvester.harvest.called
    harvester.harvest.assert_called_once_with(days_back=10)
Exemple #7
0
def test_harvest_days_back(harvester):
    start_date = date(2015, 03, 14)
    end_date = date(2015, 03, 16)

    _, timestamps = tasks.harvest("test", "TIME", start_date=start_date, end_date=end_date)

    keys = ["harvestFinished", "harvestTaskCreated", "harvestStarted"]

    for key in keys:
        assert key in timestamps.keys()

    assert harvester.harvest.called
    harvester.harvest.assert_called_once_with(start_date=start_date, end_date=end_date)
Exemple #8
0
def test_harvest_days_back(harvester):
    start_date = date(2015, 03, 14)
    end_date = date(2015, 03, 16)

    _, timestamps = tasks.harvest('test', 'TIME', start_date=start_date, end_date=end_date)

    keys = ['harvestFinished', 'harvestTaskCreated', 'harvestStarted']

    for key in keys:
        assert key in timestamps.keys()

    assert harvester.harvest.called
    harvester.harvest.assert_called_once_with(start_date=start_date, end_date=end_date)
Exemple #9
0
def test_harvest_days_back(harvester):
    start_date = date(2015, 3, 14)
    end_date = date(2015, 3, 16)

    _, timestamps = tasks.harvest('test', 'TIME', start_date=start_date, end_date=end_date)

    keys = ['harvestFinished', 'harvestTaskCreated', 'harvestStarted']

    for key in keys:
        assert key in timestamps.keys()

    assert harvester.harvest.called
    harvester.harvest.assert_called_once_with(start_date=start_date, end_date=end_date)
Exemple #10
0
def test_harvest_runs_harvest(harvester):
    tasks.harvest('test', 'TIME')

    assert harvester.harvest.called
Exemple #11
0
def test_harvest_runs_harvest(harvester):
    tasks.harvest("test", "TIME")

    assert harvester.harvest.called
Exemple #12
0
def test_harvest_runs_harvest(harvester):
    tasks.harvest('test', 'TIME')

    assert harvester.harvest.called