示例#1
0
def test_submit_workflow(requests, app, tmpdir):
    app.config['postproc_server'] = 'http://127.0.0.1:5000'
    app.config['mode'] = 'scanner'
    client = app.test_client()
    wfid = create_workflow(client)
    with mock.patch('spreadsplug.web.app.task_queue') as mock_tq:
        mock_tq.task.return_value = lambda x: x
        requests.post.return_value.json.return_value = {'id': 1}
        client.post('/api/workflow/{0}/submit'.format(wfid),
                    content_type="application/json",
                    data=json.dumps({'config': {'plugins': []},
                                     'server': '127.0.0.1:5000'}))
    assert requests.post.call_count == 1
示例#2
0
def client(app):
    yield app.test_client()