Esempio n. 1
0
    def test_buttons_last_fragment_readonly(self):
        rendering_rules = SimulatorFragmentRenderingRules(is_launch_fragment=True, is_simulation_readonly_load=True)
        soup = self.prepare_simulator_form_for_search(rendering_rules)

        all_buttons = soup.find_all('button')
        assert len(all_buttons) == 1
        hidden_buttons = soup.find_all('button', attrs=dict(style="visibility: hidden"))
        assert len(hidden_buttons) == 1
Esempio n. 2
0
    def test_buttons_model_fragment(self):
        rendering_rules = SimulatorFragmentRenderingRules(form_action_url='dummy_url', last_form_url='dummy_url',
                                                          is_model_fragment=True, is_surface_simulation=True)
        soup = self.prepare_simulator_form_for_search(rendering_rules)

        all_buttons = soup.find_all('button')
        assert len(all_buttons) == 4
        hidden_buttons = soup.find_all('button', attrs=dict(style="visibility: hidden"))
        assert len(hidden_buttons) == 0
Esempio n. 3
0
    def test_buttons_first_fragment_copy(self):
        rendering_rules = SimulatorFragmentRenderingRules(is_first_fragment=True, is_simulation_copy=True)
        soup = self.prepare_simulator_form_for_search(rendering_rules)

        all_buttons = soup.find_all('button')
        assert len(all_buttons) == 1
        assert all_buttons[0].attrs['name'] == 'next'
        hidden_buttons = soup.find_all('button', attrs=dict(style="visibility: hidden"))
        assert len(hidden_buttons) == 1
Esempio n. 4
0
    def test_buttons_middle_fragment(self):
        rendering_rules = SimulatorFragmentRenderingRules(form_action_url='dummy_url', last_form_url='dummy_url')
        soup = self.prepare_simulator_form_for_search(rendering_rules)

        all_buttons = soup.find_all('button')
        assert len(all_buttons) == 2
        assert all_buttons[0].attrs['name'] == 'previous'
        assert all_buttons[1].attrs['name'] == 'next'
        hidden_buttons = soup.find_all('button', attrs=dict(style="visibility: hidden"))
        assert len(hidden_buttons) == 0
Esempio n. 5
0
    def test_buttons_first_fragment(self):
        rendering_rules = SimulatorFragmentRenderingRules(form_action_url=SimulatorWizzardURLs.SET_CONNECTIVITY_URL,
                                                          is_first_fragment=True)
        soup = self.prepare_simulator_form_for_search(rendering_rules)

        all_buttons = soup.find_all('button')
        assert len(all_buttons) == 1
        assert all_buttons[0].attrs['name'] == 'next'
        hidden_buttons = soup.find_all('button', attrs=dict(style="visibility: hidden"))
        assert len(hidden_buttons) == 0
Esempio n. 6
0
    def test_simulator_adapter_form(self):
        rendering_rules = SimulatorFragmentRenderingRules()
        soup = self.prepare_simulator_form_for_search(rendering_rules)

        connectivity_select_field = soup.find_all('select', attrs=dict(name='connectivity'))
        assert len(connectivity_select_field) == 1, 'Number of connectivity select inputs is different than 1'
        conduction_speed_input = soup.find_all('input', attrs=dict(name='conduction_speed'))
        assert len(conduction_speed_input) == 1, 'Number of conduction speed inputs is different than 1'
        coupling_select_filed = soup.find_all('select', attrs=dict(name='coupling'))
        assert len(coupling_select_filed) == 1, 'Number of coupling select inputs is different than 1'
Esempio n. 7
0
    def test_buttons_last_fragment(self, mocker):
        rendering_rules = SimulatorFragmentRenderingRules(
            form_action_url=SimulatorWizzardURLs.SETUP_PSE_URL,
            last_form_url=SimulatorWizzardURLs.SETUP_PSE_URL,
            is_launch_fragment=True)
        soup = self.prepare_simulator_form_for_search(mocker, rendering_rules)

        all_buttons = soup.find_all('button')
        assert len(all_buttons) == 3
        hidden_buttons = soup.find_all('button',
                                       attrs=dict(style="visibility: hidden"))
        assert len(hidden_buttons) == 0
Esempio n. 8
0
    def test_models_list(self):
        all_models_for_ui = get_ui_name_to_model()
        models_form = SimulatorModelFragment()
        simulator = Simulator()
        simulator.model = ModelsEnum.EPILEPTOR.get_class()()
        models_form.fill_from_trait(simulator)

        rendering_rules = SimulatorFragmentRenderingRules(is_model_fragment=True)
        soup = self.prepare_simulator_form_for_search(rendering_rules, form=models_form)

        select_field = soup.find_all('select')
        assert len(select_field) == 1, 'Number of select inputs is different than 1'
        select_field_options = soup.find_all('option')
        assert len(select_field_options) == len(all_models_for_ui), 'Number of select field options != number of models'
        select_field_choice = soup.find_all('option', selected=True)
        assert len(select_field_choice) == 1
        assert 'Epileptor' in select_field_choice[0].attrs['value']