Пример #1
0
def test_get_all_actions(*args):
    """
    Tests the main response from get all actions
    """
    action_resource = ActionsResource()
    action_resource.get_all_actions_db = actions_db
    action_resource.get_all_dag_runs_db = dag_runs_db
    action_resource.get_all_tasks_db = tasks_db
    result = action_resource.get_all_actions(verbosity=1)
    assert len(result) == len(actions_db())
    for action in result:
        if action['name'] == 'dag_it':
            assert len(action['steps']) == 1
            assert action['dag_status'] == 'FAILED'
        if action['name'] == 'dag2':
            assert len(action['steps']) == 3
            assert action['dag_status'] == 'SUCCESS'
Пример #2
0
def test_get_all_actions():
    """
    Tests the main response from get all actions
    """
    action_resource = ActionsResource()
    action_resource.get_all_actions_db = actions_db
    action_resource.get_all_dag_runs_db = dag_runs_db
    action_resource.get_all_tasks_db = tasks_db
    os.environ['DB_CONN_AIRFLOW'] = 'nothing'
    os.environ['DB_CONN_SHIPYARD'] = 'nothing'
    result = action_resource.get_all_actions()
    assert len(result) == len(actions_db())
    for action in result:
        if action['name'] == 'dag_it':
            assert len(action['steps']) == 1
            assert action['dag_status'] == 'FAILED'
        if action['name'] == 'dag2':
            assert len(action['steps']) == 3
            assert action['dag_status'] == 'SUCCESS'
Пример #3
0
def test_get_all_actions_notes(*args):
    """
    Tests the main response from get all actions
    """
    action_resource = ActionsResource()
    action_resource.get_all_actions_db = actions_db
    action_resource.get_all_dag_runs_db = dag_runs_db
    action_resource.get_all_tasks_db = tasks_db
    # inject some notes
    nh.make_action_note('aaaaaa', "hello from aaaaaa1")
    nh.make_action_note('aaaaaa', "hello from aaaaaa2")
    nh.make_action_note('bbbbbb', "hello from bbbbbb")

    result = action_resource.get_all_actions(verbosity=1)
    assert len(result) == len(actions_db())
    for action in result:
        if action['id'] == 'aaaaaa':
            assert len(action['notes']) == 2
        if action['id'] == 'bbbbbb':
            assert len(action['notes']) == 1
            assert action['notes'][0]['note_val'] == 'hello from bbbbbb'