def test_summary_pages_links(provider, cls):

    navigate_to(cls.object, "All")
    all_url = sel.current_url()
    tb.select("List View")
    name = choice([r[2].text for r in list_tbl.rows()])
    obj = cls.object(name, provider)
    obj.summary  # <- reload summary

    breads = breadcrumbs()
    bread_names = map(sel.text_sane, breads)

    if cls.breadcrumb_member.startswith("Container") and cls.breadcrumb_member not in bread_names:
        breadcrumb_member = cls.breadcrumb_member.split(" ")[-1]
    else:
        breadcrumb_member = cls.breadcrumb_member

    assert breadcrumb_member in bread_names

    chosen_link = next(b for b in breads if sel.text_sane(b) == breadcrumb_member)

    sel.click(chosen_link)

    # TODO: replace with widgetastic view.is_displayed function when available
    assert sel.current_url().split("?")[0] == all_url.split("?")[0]
def test_pods_properties_rel(provider, rel):
    """ This module verifies data integrity in the Properties table for:
        pods, routes and projects
    """
    sel.force_navigate('containers_pods')
    ui_pods = [r.name.text for r in list_tbl_pods.rows()]

    for name in ui_pods:
        obj = Pod(name, provider)
        assert getattr(obj.summary.properties, rel).text_value
def test_pods_properties_rel(provider, rel):
    """ Properties table fields tests - Containers Pods' summary page
    This test verifies the fields of the Properties table in Containers Pods'
    details menu
    Steps:
    Containers -- > Containers Pods
    Loop through each Pod object in the table and check validity of
    the fields in the Properties table
    """
    navigate_to(Pod, 'All')
    ui_pods = [r.name.text for r in list_tbl_pods.rows()]

    for name in ui_pods:
        obj = Pod(name, provider)
        assert getattr(obj.summary.properties, rel).text_value
def test_summary_properties_validation(provider):
    """ This test verifies that the sum of running, waiting and terminated containers
        in the status summary table
        is the same number that appears in the Relationships table containers field
    """
    navigate_to(Pod, 'All')
    ui_pods = [r.name.text for r in list_tbl.rows()]

    for name in ui_pods:
        obj = Pod(name, provider)
        num_cont_running = obj.summary.container_statuses_summary.running.value
        num_cont_waiting = obj.summary.container_statuses_summary.waiting.value
        num_cont_terminated = obj.summary.container_statuses_summary.terminated.value
        num_cont_total = obj.summary.relationships.containers.value
        assert num_cont_total == num_cont_running + \
            num_cont_terminated + num_cont_waiting