# Path: src/tests/behave/api/features/common/utils.py
# def read_json_from_file(filename, location):
#     filename = "{0}/{1}".format(location, filename)
#     with open(filename) as file:
#         data = json.loads(file.read())
#     return data


import re
import json
import time
import operator
from functools import reduce
from behave import given, then, when, step, use_step_matcher
from src.tests.behave.api.features.common.utils import read_json_from_file
        context.check.assertEqual(
            task_message["returncode"],
            returncode,
            msg="Returncode was {}, should be {}".format(
                task_message["returncode"], returncode
            ),
        )
        context.check.assertEqual(
            task_message["stderr"],
            stderr,
            msg="Stderr was {}, should be {}".format(
                task_message["stderr"], stderr
            ),
        )


@then(
    "the first {service_name} task for the {device_service} device has the message output contained in {out_filename}"
)
def step_the_first_task_has_message_output_in_file(
    context, service_name, out_filename, device_service
):
    """
    :type context: behave.runner.Context
    :type service_name: str
    :type out_filename: str
    """
    service_client = context.services[service_name]["client"]
    device_client = context.services[device_service]["client"]
    location = context.json_location

# Path: src/tests/behave/api/features/common/utils.py
# def read_json_from_file(filename, location):
#     filename = "{0}/{1}".format(location, filename)
#     with open(filename) as file:
#         data = json.loads(file.read())
#     return data


# Path: src/tests/behave/api/features/steps/rpc_capabilities.py
import re
import json
import time
import operator
from functools import reduce
from behave import given, then, when, step, use_step_matcher
from src.tests.behave.api.features.common.utils import read_json_from_file

        context.check.assertEqual(
            task_message["returncode"],
            returncode,
            msg="Returncode was {}, should be {}".format(
                task_message["returncode"], returncode
            ),
        )
        context.check.assertEqual(
            task_message["stderr"],
            stderr,
            msg="Stderr was {}, should be {}".format(
                task_message["stderr"], stderr
            ),
        )


@then(
    "the first {service_name} task for the {device_service} device has the message output contained in {out_filename}"
)
def step_the_first_task_has_message_output_in_file(
    context, service_name, out_filename, device_service
):
    """
    :type context: behave.runner.Context
    :type service_name: str
    :type out_filename: str
    """
    service_client = context.services[service_name]["client"]
    device_client = context.services[device_service]["client"]
    location = context.json_location

    data = read_json_from_file(out_filename, location)