Beispiel #1
0
def test_pipelines():
    result = execute_dagster_graphql(define_context(), '{ pipelines { nodes { name } } }')
    assert not result.errors
    assert result.data

    assert {p['name'] for p in result.data['pipelines']['nodes']} == {
        p.name for p in define_repository().get_all_pipelines()
    }
Beispiel #2
0
def test_pipeline_by_name_not_found():
    with pytest.raises(UserFacingGraphQLError) as exc:
        execute_dagster_graphql(
            define_context(),
            '''
        {
            pipeline(params: {name: "gkjhds"}) {
              name
            }
        }''',
        )

    assert isinstance(exc.value.dauphin_error, DauphinPipelineNotFoundError)
Beispiel #3
0
def test_pipeline_by_name():
    result = execute_dagster_graphql(
        define_context(),
        '''
    {
        pipeline(params: {name: "csv_hello_world_two"}) {
            name
        }
    }''',
    )

    assert not result.errors
    assert result.data
    assert result.data['pipeline']['name'] == 'csv_hello_world_two'
Beispiel #4
0
def test_enum_query():
    ENUM_QUERY = '''{
  pipeline(params: { name:"pipeline_with_enum_config" }){
    __typename
    ... on Pipeline {
      name
      configTypes {
        __typename
        name
        ... on EnumConfigType {
          values
          {
            value
            description
          }
        }
      }
    }
  }
}
'''

    result = execute_dagster_graphql(define_context(), ENUM_QUERY)

    assert not result.errors
    assert result.data

    enum_type_data = None

    for td in result.data['pipeline']['configTypes']:
        if td['name'] == 'TestEnum':
            enum_type_data = td
            break

    assert enum_type_data
    assert enum_type_data['name'] == 'TestEnum'
    assert enum_type_data['values'] == [
        {
            'value': 'ENUM_VALUE_ONE',
            'description': 'An enum value.'
        },
        {
            'value': 'ENUM_VALUE_TWO',
            'description': 'An enum value.'
        },
        {
            'value': 'ENUM_VALUE_THREE',
            'description': 'An enum value.'
        },
    ]
Beispiel #5
0
def test_enum_query():
    ENUM_QUERY = '''{
    environmentSchemaOrError(selector: {name: "pipeline_with_enum_config" } ) {
      ... on EnvironmentSchema {
        allConfigTypes {
          __typename
          key 
          ... on EnumConfigType {
            values
            {
              value
              description
            }
          }
        }
      }
    }
  }
  '''

    result = execute_dagster_graphql(define_context(), ENUM_QUERY)

    assert not result.errors
    assert result.data

    enum_type_data = None

    for td in result.data['environmentSchemaOrError']['allConfigTypes']:
        if td['key'] == 'TestEnum':
            enum_type_data = td
            break

    assert enum_type_data
    assert enum_type_data['key'] == 'TestEnum'
    assert enum_type_data['values'] == [
        {
            'value': 'ENUM_VALUE_ONE',
            'description': 'An enum value.'
        },
        {
            'value': 'ENUM_VALUE_TWO',
            'description': 'An enum value.'
        },
        {
            'value': 'ENUM_VALUE_THREE',
            'description': 'An enum value.'
        },
    ]
Beispiel #6
0
def test_pipeline_or_error_by_name_not_found():
    result = execute_dagster_graphql(
        define_context(),
        '''
    {
        pipelineOrError(params: { name: "foobar" }) {
          __typename
          ... on Pipeline {
             name
           }
        }
    }''',
    )

    assert not result.errors
    assert result.data
    assert result.data['pipelineOrError']['__typename'] == 'PipelineNotFoundError'
Beispiel #7
0
def test_production_query(production_query):
    result = execute_dagster_graphql(define_context(), production_query)

    assert not result.errors
    assert result.data
Beispiel #8
0
def test_type_rendering():
    result = execute_dagster_graphql(define_context(), TYPE_RENDER_QUERY)
    assert not result.errors
    assert result.data
Beispiel #9
0
def test_production_config_editor_query():
    result = execute_dagster_graphql(define_context(), ALL_TYPES_QUERY)

    assert not result.errors
    assert result.data
Beispiel #10
0
def test_production_query():
    result = execute_dagster_graphql(define_context(), PRODUCTION_QUERY)

    assert not result.errors
    assert result.data