def test_valid_txt(self): list_txt_valid = [ "test=name.abcd", "name=als1243@#$%as.com", "abc=def" ] for data in list_txt_valid: result = validate_domain_data(QTYPE[16], data) self.assertEqual(result, data)
def test_invalid_txt(self): list_txt_invalid = [ "", "list_txt_valid", "testname.abcd", "nameals1243@#$%as.com" ] for data in list_txt_invalid: result = validate_domain_data(QTYPE[16], data) self.assertIsNone(result)
def test_invalid_cname(self): list_cname_invalid = [ "", "123test.com.br", "abc.com.b4", "abd@#$%^.com", "abc.com.n$" ] for data in list_cname_invalid: result = validate_domain_data(QTYPE[5], data) self.assertIsNone(result)
def test_invalid_a(self): list_ipv4_invalid = [ "30.168.1.255.1", "127.1", "192.168.1.256", "-1.2.3.4", "3...3", "http://30.168.1.255.1:80" ] for data in list_ipv4_invalid: result = validate_domain_data(QTYPE[1], data) self.assertIsNone(result)
def test_valid_a(self): list_ipv4_valid = [ "127.0.0.1", "192.168.1.1", "192.168.1.255", "255.255.255.255", "0.0.0.0", "1.1.1.1" ] for data in list_ipv4_valid: result = validate_domain_data(QTYPE[1], data) self.assertEqual(result, data)
def test_valid_cname(self): list_cname_valid = [ "www.google.com", "abc-test.net", "test123abc.com", "asasasas12334.sdadg.as12434-asas.net" ] for data in list_cname_valid: result = validate_domain_data(QTYPE[5], data) self.assertEqual(result, data)
def test_invalid_aaaa(self): list_ipv6_invalid = [ "1200:0000:AB00:1234:O000:2552:7777:1313 ", "[2001:db8:0:1]:80 ", "30.168.1.255.1", "FE80:0000:0000:0^&0:0202:B3FF:FE1E:8329", "http://[2001:db8:0:1]:80", "192.168.1.256", "-1.2.3.4", "3...3" ] for data in list_ipv6_invalid: result = validate_domain_data(QTYPE[28], data) self.assertIsNone(result)
def test_valid_aaaa(self): list_ipv6_valid = [ "1200:0000:AB00:1234:0000:2552:7777:1313", "21DA:D3:0:2F3B:2AA:FF:FE28:9C5A", "FE80:0000:0000:0000:0202:B3FF:FE1E:8329", "21DA:D3:0::9C5A" ] for data in list_ipv6_valid: result = validate_domain_data(QTYPE[28], data) self.assertEqual(result, data)
def test_cname_integer(self): result = validate_domain_data(QTYPE[16], 1345) self.assertIsNone(result)
def test_txt_string(self): result = validate_domain_data(QTYPE[16], "abcDE%^$#!Fgh") self.assertIsNone(result)
def test_txt_null(self): result = validate_domain_data(QTYPE[16], None) self.assertIsNone(result)
def test_cname_null(self): result = validate_domain_data(QTYPE[5], None) self.assertIsNone(result)
def test_aaaa_integer(self): result = validate_domain_data(QTYPE[28], 1345) self.assertIsNone(result)
def test_aaaa_null(self): result = validate_domain_data(QTYPE[28], None) self.assertIsNone(result)