def add_components_to_product(step, stored_product, product_name):
    productModel = ProductModel()
    product = productModel.get_stored_or_store_obj(stored_product, product_name)

    product_resid, version = productModel.get_resid(product)

    for component in step.hashes:
        productModel.add_component(product_resid, version,
                                   {"name": component["name"],
                                    "description": component["description"]})
def product_has_environmentgroups(step, stored_product, product_name, expect_any):
    productModel = ProductModel()
    product = productModel.get_stored_or_store_obj(stored_product, product_name)
    product_id = get_resource_identity(product)[0]

    # get the list of testcases for this product
    envgrp_list = productModel.get_environmentgroup_list(product_id)

    # this checks that the lengths match.  The expect_any holder is not used, but it allows for
    # alternate wording in the step.
    eq_list_length(envgrp_list, step.hashes)

    # walk through and verify that each testcase has the expected status
    for envgrp in step.hashes:
        # find that in the list of testcases
        exp_name = envgrp["name"]

        verify_single_item_in_list(envgrp_list,
                                   "name",
                                   exp_name)