How to use the behave.given function in behave

To help you get started, we’ve selected a few behave examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zatosource / zato-apitest / src / zato / apitest / steps / json.py View on Github external
@given('JSON Pointer "{path}" in request is an integer "{value}"')
@util.obtain_values
def given_json_pointer_in_request_is_an_integer(ctx, path, value):
    set_pointer(ctx, path, int(value))
github Yelp / paasta / general_itests / steps / http_drain_method_steps.py View on Github external
@given("a fake HTTP server")
def make_fake_http_server(context):
    context.fake_http_server = FakeHTTPServer()
    context.fake_http_server.start()
github python-openxml / python-docx / features / steps / hdrftr.py View on Github external
@given("a _Footer object {with_or_no} footer definition as footer")
def given_a_Footer_object_with_or_no_footer_definition(context, with_or_no):
    section_idx = {"with a": 0, "with no": 1}[with_or_no]
    context.sections = Document(test_docx("hdr-header-footer")).sections
    context.footer = context.sections[section_idx].footer
github scanny / python-pptx / features / steps / slidemaster.py View on Github external
@given('a slide master having two slide layouts')
def given_slide_master_having_two_layouts(context):
    prs = Presentation(test_pptx('mst-slide-layouts'))
    context.slide_master = prs.slide_master
github cyverse / atmosphere / features / steps / allocation_steps.py View on Github external
@given('Allocation Source')
def give_allocation_source(context):
    for row in context.table:
        response = context.client.post(
            '/api/v2/allocation_sources', {
                "renewal_strategy": row['renewal strategy'],
                "name": row['name'],
                "compute_allowed": row['compute allowed']
            }
        )
        context.source_id = response.data['uuid']
        context.name = row['name']
github scanny / python-pptx / features / steps / chart.py View on Github external
@given("a chart of type {chart_type}")
def given_a_chart_of_type_chart_type(context, chart_type):
    slide_idx, shape_idx = {
        "Area": (0, 0),
        "Stacked Area": (0, 1),
        "100% Stacked Area": (0, 2),
        "3-D Area": (0, 3),
        "3-D Stacked Area": (0, 4),
        "3-D 100% Stacked Area": (0, 5),
        "Clustered Bar": (1, 0),
        "Stacked Bar": (1, 1),
        "100% Stacked Bar": (1, 2),
        "Clustered Column": (1, 3),
        "Stacked Column": (1, 4),
        "100% Stacked Column": (1, 5),
        "Line": (2, 0),
        "Stacked Line": (2, 1),
github quantumblacklabs / kedro-docker / features / steps / cli_steps.py View on Github external
@given("I have removed old docker image of test project")
def remove_old_docker_images(context):
    """Remove old docker images of project"""
    run(["docker", "rmi", context.project_name])
github scanny / python-pptx / features / steps / shapes.py View on Github external
@given("a MasterShapes object of length 2 as shapes")
def given_a_MasterShapes_object_of_length_2_as_shapes(context):
    prs = Presentation(test_pptx("mst-shapes"))
    context.shapes = prs.slide_masters[0].shapes
github quantumblacklabs / kedro / features / steps / io_core_steps.py View on Github external
@given("I have defined a custom CSV data set without providing a save method")
def data_set_with_no_save(context):
    context.csv_data_set = LambdaDataSet(load=None, save=None)
github python-openxml / python-docx / features / steps / parfmt.py View on Github external
@given('a paragraph format having {type} indent of {value}')
def given_a_paragraph_format_having_type_indent_value(context, type, value):
    style_name = {
        'inherit':  'Normal',
        '18 pt':    'Base',
        '17.3 pt':  'Base',
        '-17.3 pt': 'Citation',
        '46.1 pt':  'Citation',
    }[value]
    document = Document(test_docx('sty-known-styles'))
    context.paragraph_format = document.styles[style_name].paragraph_format