def test_ui_stream_field_GIVEN_f142_is_selected_WHEN_combo_is_changed_THEN_value_units_edit_is_shown( qtbot, ): listwidget = QListWidget() listwidget.field_name_edit = QLabel() field = FieldWidget(None, POSSIBLE_FIELDS, listwidget) field_name = "test" field.name = field_name stream_fields_widget = StreamFieldsWidget(field) qtbot.addWidget(stream_fields_widget) stream_fields_widget.schema_combo.currentTextChanged.emit("f142") assert stream_fields_widget.value_units_edit.isEnabled() assert stream_fields_widget.value_units_label.isEnabled()
def test_ui_stream_field_GIVEN_f142_is_selected_WHEN_advanced_options_are_clicked_THEN_f142_group_box_is_shown( qtbot, ): listwidget = QListWidget() listwidget.field_name_edit = QLabel() field = FieldWidget(None, POSSIBLE_FIELDS, listwidget) field_name = "test" field.name = field_name stream_fields_widget = StreamFieldsWidget(field) stream_fields_widget.schema_combo.setCurrentText("f142") qtbot.addWidget(stream_fields_widget) stream_fields_widget.f142_advanced_group_box.setVisible = Mock() stream_fields_widget._show_advanced_options(True) stream_fields_widget.f142_advanced_group_box.setVisible.assert_called_once_with( True)