예제 #1
0
파일: test_jobs.py 프로젝트: Yelp/mycroft
def test_jobs_update_job_errors(err_instance, expected_return_code):
    dr = dummy_request()
    with patch('mycroft.models.aws_connections.TableConnection.get_connection'):
        with patch('mycroft.views.jobs.get_scanner_queue'):
            with patch('mycroft.views.jobs.put_job') as put_job:
                put_job.side_effect = err_instance
                actual_return_code, _ = jobs_update_job(dr)
            assert actual_return_code == expected_return_code
예제 #2
0
def test_jobs_update_job_errors(err_instance, expected_return_code):
    dr = dummy_request()
    with patch(
            'mycroft.models.aws_connections.TableConnection.get_connection'):
        with patch('mycroft.views.jobs.get_scanner_queue'):
            with patch('mycroft.views.jobs.put_job') as put_job:
                put_job.side_effect = err_instance
                actual_return_code, _ = jobs_update_job(dr)
            assert actual_return_code == expected_return_code
예제 #3
0
파일: test_jobs.py 프로젝트: Yelp/mycroft
def test_jobs_update_job(request_method, parm):
    dr = dummy_request()
    dr.method = request_method
    expected_return_code = 200
    with patch('mycroft.models.aws_connections.TableConnection.get_connection'):
        with patch('mycroft.views.jobs.get_scanner_queue'):
            with patch(parm) as list_action:
                list_action.return_value = {}
                actual_return_code, _ = jobs_update_job(dr)
            assert actual_return_code == expected_return_code
예제 #4
0
def test_jobs_update_job(request_method, parm):
    dr = dummy_request()
    dr.method = request_method
    expected_return_code = 200
    with patch(
            'mycroft.models.aws_connections.TableConnection.get_connection'):
        with patch('mycroft.views.jobs.get_scanner_queue'):
            with patch(parm) as list_action:
                list_action.return_value = {}
                actual_return_code, _ = jobs_update_job(dr)
            assert actual_return_code == expected_return_code