def test_ip_missing(self): params = {} validator = Validator(params) ip = validator.ip() self.assertIsNone(ip) self.assertEquals(0, len(validator.errors))
def test_ip_default(self): params = {} validator = Validator(params) ip = validator.ip('192.168.0.1') self.assertEquals(ip, '192.168.0.1') self.assertEquals(0, len(validator.errors))
def test_errors_aggregated(self): params = {} validator = Validator(params) validator.user_domain() validator.password() self.assertEquals(2, len(validator.errors))
def assertPortError(self, params): validator = Validator(params) value = validator.port('port') self.assertEqual(len(validator.errors), 1) return value
def assertNewPasswordError(self, params): validator = Validator(params) value = validator.new_password() self.assertEqual(len(validator.errors), 1) return value
def assertEmailError(self, params): validator = Validator(params) value = validator.email() self.assertEqual(len(validator.errors), 1) return value
def assertUsernameError(self, params): validator = Validator(params) value = validator.new_user_domain() self.assertEqual(len(validator.errors), 1) return value
def test_ip_invalid(self): params = {'ip': '256.256.256.256'} validator = Validator(params) ip = validator.ip() self.assertEqual(len(validator.errors), 1)
def assertPortError(self, params): validator = Validator(params) value = validator.port() self.assertEqual(len(validator.errors), 1) return value