def __validate_input(self) -> bool:
        if not utilities.valid_ip_address(self._leIpAddr.text()):
            utilities.show_error_message_box(self, self.__ERR_MSG_INVALID_IP +
                                             self._leIpAddr.text())
            return False

        if not utilities.valid_port(self._lePort.text()):
            utilities.show_error_message_box(self, self.__ERR_MSG_INVALID_PORT +
                                             self._lePort.text())
            return False

        if len(self._leUserName.text()) == 0:
            utilities.show_error_message_box(self, self.__ERR_MSG_INVALID_USER)
            return False

        if len(self._lePasswd.text()) == 0:
            utilities.show_error_message_box(self, self.__ERR_MSG_INVALID_PASSWD)
            return False
        return True
Example #2
0
 def test_validPort_returnFalse_whenPortStringContainsNoneDigit(self):
     self.assertFalse(utilities.valid_port('88a9'))
Example #3
0
 def test_validPort_returnFalse_whenPortIsOutOfRange(self):
     self.assertFalse(utilities.valid_port('65536'))
Example #4
0
 def test_validPort_returnTrue_whenPortIsValid(self):
     self.assertTrue(utilities.valid_port('8889'))