예제 #1
0
def test_run_cron(mock_general_update, mock_firewall_flock, mock_cron_args):
    firewall_update.run_cron(mock_cron_args)
    assert mock_general_update.called is True
    assert mock_firewall_flock.return_value.__enter__.called is True
예제 #2
0
def test_run_cron_flock_error(mock_general_update, mock_firewall_flock,
                              mock_cron_args):
    with pytest.raises(TimeoutError):
        firewall_update.run_cron(mock_cron_args)
예제 #3
0
def test_run_cron(mock_cron_args):
    with mock.patch.object(firewall, 'general_update', autospec=True) as m:
        firewall_update.run_cron(mock_cron_args)
    assert m.called is True