Beispiel #1
0
def test_backend_addr_validator(qtbot, core_config):
    switch_language(core_config, "en")

    le = ValidatedLineEdit()
    le.set_validator(validators.BackendAddrValidator())
    qtbot.add_widget(le)
    le.show()

    qtbot.keyClicks(le, "http://host:1337")
    qtbot.wait_until(lambda: le.text() == "http://host:1337")
    assert not le.is_input_valid()
    assert le.property("validity") == QtGui.QValidator.Invalid

    le.setText("")
    qtbot.wait_until(lambda: le.text() == "")
    assert not le.is_input_valid()
    assert le.property("validity") == QtGui.QValidator.Intermediate

    qtbot.keyClicks(le, "parsec://host:1337")
    qtbot.wait_until(lambda: le.text() == "parsec://host:1337")
    assert le.is_input_valid()
    assert le.property("validity") == QtGui.QValidator.Acceptable

    qtbot.keyClicks(le, "/org")
    qtbot.wait_until(lambda: le.text() == "parsec://host:1337/org")
    assert not le.is_input_valid()
    assert le.property("validity") == QtGui.QValidator.Invalid
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.line_edit_user_email.validity_changed.connect(self.check_infos)
     self.line_edit_user_email.set_validator(validators.EmailValidator())
     self.line_edit_user_full_name.textChanged.connect(self.check_infos)
     self.line_edit_org_name.validity_changed.connect(self.check_infos)
     self.line_edit_org_name.set_validator(
         validators.OrganizationIDValidator())
     self.line_edit_backend_addr.set_validator(
         validators.BackendAddrValidator())
     self.line_edit_backend_addr.validity_changed.connect(self.check_infos)
     self.check_accept_contract.clicked.connect(self.check_infos)
     self.check_use_custom_backend.clicked.connect(
         self._on_use_custom_backend_clicked)
     self.widget_custom_backend.hide()
Beispiel #3
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.line_edit_user_email.validity_changed.connect(self.check_infos)
     self.line_edit_user_email.set_validator(validators.EmailValidator())
     self.line_edit_user_full_name.textChanged.connect(self.check_infos)
     self.line_edit_org_name.validity_changed.connect(self.check_infos)
     self.line_edit_org_name.set_validator(
         validators.OrganizationIDValidator())
     self.line_edit_backend_addr.set_validator(
         validators.BackendAddrValidator())
     self.line_edit_backend_addr.validity_changed.connect(self.check_infos)
     self.check_accept_contract.clicked.connect(self.check_infos)
     self.radio_use_commercial.toggled.connect(self._switch_server)
     self.radio_use_custom.toggled.connect(self._switch_server)
     self.radio_use_commercial.setChecked(True)