Beispiel #1
0
    def test_models_list(self, mocker):
        models_form = SimulatorModelFragment()
        simulator = Simulator()
        simulator.model = ModelsEnum.EPILEPTOR.instance
        models_form.fill_from_trait(simulator)

        rendering_rules = SimulatorFragmentRenderingRules(is_model_fragment=True)
        soup = self.prepare_simulator_form_for_search(mocker, 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(ModelsEnum), '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']
Beispiel #2
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)

        html = str(models_form)
        soup = BeautifulSoup(html)

        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']