How to use the behave.then 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 sync-for-science / test-suite / features / steps / argonaut.py View on Github external
@then(u'there exists one {name} in {field_name}')
def step_impl(context, name, field_name):

    if not StepDecider(context).should_run_test():
        return

    path = field_name.split('.')
    filter_type = path.pop(0)
    resources = get_resources(context.response.json(), filter_type)

    for res in resources:
        found = utils.traverse(res, path)
        assert found is not None, utils.bad_response_assert_with_resource(response=context.response,
                                                                          message=ERROR_REQUIRED,
                                                                          name=name,
                                                                          resource=res)
github zatosource / zato-apitest / src / zato / apitest / steps / cassandra_.py View on Github external
@then('I delete from Cassandra table "{tablename}" where "{criterion}", using "{conn_name}"')
@util.obtain_values
def then_i_delete_from_cassandra_table(ctx, tablename, conn_name, criterion=None):
    if not criterion:
        criterion = ''
    insert = "DELETE FROM %s %s" % (tablename, criterion)
    ctx.zato.user_ctx[conn_name].execute(insert)
github algorand / py-algorand-sdk / test / steps / steps.py View on Github external
@then("the asset info should match the expected asset info")
def asset_info_match(context):
    for k in context.expected_asset_info:
        assert (context.expected_asset_info[k] == context.asset_info.get(k)) or ((not context.expected_asset_info[k]) and (not context.asset_info.get(k)))
github behave / behave / behave4cmd0 / command_steps.py View on Github external
@then(u'it should fail')
def step_it_should_fail(context):
    assert_that(context.command_result.returncode, is_not(equal_to(0)),
                context.command_result.output)
github python-openxml / python-docx / features / steps / shape.py View on Github external
@then('the length of the inline shape collection is 5')
def then_len_of_inline_shape_collection_is_5(context):
    inline_shapes = context.inline_shapes
    shape_count = len(inline_shapes)
    assert shape_count == 5, 'got %s' % shape_count
github scanny / python-pptx / features / steps / font.py View on Github external
@then("font.bold is {value}")
def then_font_bold_is_value(context, value):
    expected_value = {"True": True, "False": False, "None": None}[value]
    font = context.font
    assert font.bold is expected_value
github python-openxml / python-docx / features / steps / styles.py View on Github external
@then('style.quick_style is {value}')
def then_style_quick_style_is_value(context, value):
    style, expected_value = context.style, bool_vals[value]
    assert style.quick_style is expected_value
github scanny / python-pptx / features / steps / action.py View on Github external
@then("click_action.hyperlink.address is {value}")
def then_click_action_hyperlink_address_is_value(context, value):
    expected_value = None if value == "None" else value
    hyperlink = context.click_action.hyperlink
    print("expected value %s != %s" % (expected_value, hyperlink.address))
    assert hyperlink.address == expected_value
github scanny / python-pptx / features / steps / shape.py View on Github external
@then("shape.height == {value}")
def then_shape_height_eq_value(context, value):
    expected_height = int(value)
    actual_height = context.shape.height
    assert actual_height == expected_height, "shape.height == %s" % actual_height
github scanny / python-pptx / features / steps / series.py View on Github external
@then("series.marker is a Marker object")
def then_series_marker_is_a_Marker_object(context):
    actual = type(context.series.marker).__name__
    assert actual == "Marker", "series.marker is a %s object" % actual