Exemplo n.º 1
0
def test_create_execution_with_missing_task():
    fabric_remote.app.testing = True
    fabric_remote.app.fi = mock.Mock()
    fabric_remote.app.fi.list_tasks.return_value = []
    client = fabric_remote.app.test_client()
    response = post_with_auth(client, '/executions')
    assert response.status_code == 400
Exemplo n.º 2
0
def test_create_execution():
    fabric_remote.app.testing = True
    fabric_remote.app.fi = mock.Mock()
    fabric_remote.app.fi.list_tasks.return_value = []
    fabric_remote.app.fi.run_tasks.return_value = ('foo', 'bar')
    client = fabric_remote.app.test_client()
    response = post_with_auth(
        client,
        '/executions',
        json.dumps({"task": "test"})
    )
    assert response.status_code == 202
Exemplo n.º 3
0
def execution():
    '''
    Runs a test execution and returns the two endpoints as a tuple
    '''
    fabric_remote.app.testing = True
    fabric_remote.app.fi = mock.Mock()
    fabric_remote.app.fi.list_tasks.return_value = []
    fabric_remote.app.fi.run_tasks.return_value = ((mock.Mock(
        is_alive=mock.Mock(return_value=False))), 'bar')
    fabric_remote.app.config['PASSWORD'] = '******'
    client = fabric_remote.app.test_client()
    response = post_with_auth(client, '/executions',
                              json.dumps({"task": "test"}))
    response = json.loads(response.data)
    return response['output'], response['results']
Exemplo n.º 4
0
def execution():
    '''
    Runs a test execution and returns the two endpoints as a tuple
    '''
    fabric_remote.app.testing = True
    fabric_remote.app.fi = mock.Mock()
    fabric_remote.app.fi.list_tasks.return_value = []
    fabric_remote.app.fi.run_tasks.return_value = (
        (mock.Mock(is_alive=mock.Mock(return_value=False))), 'bar')
    fabric_remote.app.config['PASSWORD'] = '******'
    client = fabric_remote.app.test_client()
    response = post_with_auth(
        client,
        '/executions',
        json.dumps({"task": "test"})
    )
    response = json.loads(response.data)
    return response['output'], response['results']