def test_options_interface_sites(core, wave_project):

    project_menu = ProjectMenu()
    var_tree = Tree()
    interface_name = "Site and System Options"

    project = deepcopy(wave_project)
    project_menu.activate(core, project, interface_name)

    site_system_branch = var_tree.get_branch(core, project, interface_name)
    available_sites = site_system_branch.get_input_variable(
        core, project, "hidden.available_sites")

    available_sites_dict = {
        "id": [1, 2],
        "site_name": ["a", "b"],
        "lease_area_proj4_string": ["a", "b"]
    }
    available_sites_df = pd.DataFrame(available_sites_dict)

    available_sites.set_raw_interface(core, available_sites_df)
    available_sites.read(core, project)

    can_execute = project_menu.is_executable(core, project, interface_name)

    if not can_execute:

        inputs = site_system_branch.get_input_status(core, project)
        pprint(inputs)
        assert can_execute

    connector = _get_connector(project, "project")
    interface = connector.get_interface(core, project, interface_name)

    interface.connect()

    assert interface.data.site_names.equals(available_sites_df["site_name"])
    assert interface.data.corridor_selected == False
    assert interface.data.lease_selected == False
def test_system_type_interface(core, wave_project):

    project_menu = ProjectMenu()
    var_tree = Tree()
    interface_name = "System Type Selection"

    project = deepcopy(wave_project)
    system_type_branch = var_tree.get_branch(core, project, interface_name)

    can_execute = project_menu.is_executable(core, project, interface_name)

    if not can_execute:

        inputs = system_type_branch.get_input_status(core, project)
        pprint(inputs)
        assert can_execute

    connector = _get_connector(project, "project")
    interface = connector.get_interface(core, project, interface_name)

    interface.connect()

    assert interface.data.output == True
def test_options_interface_systems(core, wave_project):

    project_menu = ProjectMenu()
    var_tree = Tree()
    interface_name = "Site and System Options"

    project = deepcopy(wave_project)
    project_menu.activate(core, project, interface_name)

    site_system_branch = var_tree.get_branch(core, project, interface_name)
    available_systems = site_system_branch.get_input_variable(
        core, project, "hidden.available_systems")

    available_systems_dict = {
        "id": [1, 2],
        "description": ["a", "b"],
        "device_type": ["a", "Wave Floating"]
    }
    available_systems_df = pd.DataFrame(available_systems_dict)

    available_systems.set_raw_interface(core, available_systems_df)
    available_systems.read(core, project)

    can_execute = project_menu.is_executable(core, project, interface_name)

    if not can_execute:

        inputs = site_system_branch.get_input_status(core, project)
        pprint(inputs)
        assert can_execute

    connector = _get_connector(project, "project")
    interface = connector.get_interface(core, project, interface_name)

    interface.connect()

    assert interface.data.system_names.equals(pd.Series(["b"]))