コード例 #1
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
    def test_update_AAAA_record(self):
        boot_strap_ipv6_reverse_domain("8.6.2.0")
        osu_block = "8620:105:F000:"
        rec0 = AddressRecord(label='', domain=self.z_o_e,
                             ip_str=osu_block + ":1", ip_type='6')
        rec1 = AddressRecord(label='foo', domain=self.z_o_e,
                             ip_str=osu_block + ":1", ip_type='6')
        rec2 = AddressRecord(label='bar', domain=self.z_o_e,
                             ip_str=osu_block + ":1", ip_type='6')

        self.do_update_AAAA_record(
            rec0, "whoooooasfjsp1", osu_block + "0:0:123:321::")
        self.do_update_AAAA_record(
            rec1, "wasfasfsafdhooooop1", osu_block + "0:0:123:321::")
        self.do_update_AAAA_record(
            rec2, "whoooooasfdisafsap1", osu_block + "0:24:123:322:1")
        self.do_update_AAAA_record(rec0, "whooooop1", osu_block + "0:aaa::1")
        self.do_update_AAAA_record(
            rec0, "wasflasksdfhooooop1", osu_block + "0:dead::")
        self.do_update_AAAA_record(rec1, "whooooosf13fp1", osu_block + "0:0::")
        self.do_update_AAAA_record(
            rec1, "whooooodfijasf1", osu_block + "0:1:23::")
        self.do_update_AAAA_record(
            rec2, "lliasdflsafwhooooop1", osu_block + ":")
        self.do_update_AAAA_record(rec1, "whooooopsjafasf1", osu_block + "0::")
        self.do_update_AAAA_record(rec1, "", osu_block + "0:0:123:321::")
コード例 #2
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
 def test_add_AAAA_address_records(self):
     osu_block = "2620:105:F000:"
     boot_strap_ipv6_reverse_domain("2.6.2.0")
     data = {'label': '', 'domain': self.f_o_e, 'ip': osu_block + ":4"}
     self.do_add_record6(data)
     data = {'label': '', 'domain': self.o_e, 'ip': osu_block + ":1"}
     self.do_add_record6(data)
     data = {'label': '6ba-r', 'domain': self.o_e, 'ip': osu_block + ":6"}
     self.do_add_record6(data)
     data = {'label': '6ba-r', 'domain': self.f_o_e, 'ip':
             osu_block + ":7"}
     self.do_add_record6(data)
     data = {'label': '6foo', 'domain': self.f_o_e, 'ip': osu_block + ":5"}
     self.do_add_record6(data)
     data = {'label': '6foo', 'domain': self.o_e, 'ip': osu_block + ":3"}
     self.do_add_record6(data)
     data = {'label': '6ba3z', 'domain': self.o_e, 'ip': osu_block + ":4"}
     self.do_add_record6(data)
     data = {'label': '6ba3z', 'domain': self.f_o_e, 'ip':
             osu_block + ":6"}
     self.do_add_record6(data)
     data = {'label': '6foob1ar', 'domain': self.o_e, 'ip':
             osu_block + ":5"}
     self.do_add_record6(data)
     data = {'label': '6foob1ar', 'domain': self.f_o_e, 'ip':
             osu_block + ":8"}
     self.do_add_record6(data)
     data = {'label': '23412341253254243', 'domain':
             self.f_o_e, 'ip': osu_block + ":8"}
     self.do_add_record6(data)
コード例 #3
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
    def test_add_AAAA_invalid_address_records(self):
        osu_block = "3620:105:F000:"
        boot_strap_ipv6_reverse_domain("3.6.2.0")

        data = {'label': 'foo.nas', 'domain': self.o_e, 'ip':
                osu_block + ":1"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'foo.bar.nas', 'domain': self.o_e, 'ip':
                osu_block + ":2"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'foo.baz.bar.nas', 'domain': self.o_e,
                'ip': osu_block + ":3"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'n as', 'domain': self.o_e, 'ip': osu_block + ":4"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'n!+/*&%$#@as', 'domain': self.o_e, 'ip':
                osu_block + ":5"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'n%as', 'domain': self.o_e, 'ip': osu_block + ":6"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'n+as', 'domain': self.o_e, 'ip': osu_block + ":7"}
        self.assertRaises(ValidationError, self.do_add_record6, data)
コード例 #4
0
ファイル: test_reverse.py プロジェクト: Ziaunys/chili
 def test_boot_strap_add_ipv6_domain(self):
     osu_block = "2.6.2.1.1.0.5.F.0.0.0"
     test_dname = osu_block + ".d.e.a.d.b.e.e.f"
     boot_strap_ipv6_reverse_domain(test_dname)
     try:
         self.create_domain(
             name='2.6.2.1.1.0.5.f.0.0.0', ip_type='6').save()
     except ValidationError, e:
         pass
コード例 #5
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
    def test_update_invalid_ip_AAAA_record(self):
        osu_block = "7620:105:F000:"
        boot_strap_ipv6_reverse_domain("7.6.2.0")
        rec0 = AddressRecord(label='foo', domain=self.z_o_e,
                             ip_str=osu_block + ":1", ip_type='6')

        self.assertRaises(ValidationError, self.do_update_AAAA_record, **{
                          'record': rec0, 'new_name': None, 'new_ip': 71134})
        self.assertRaises(ValidationError, self.do_update_AAAA_record, **{'record': rec0, 'new_name': None, 'new_ip': osu_block + ":::"})
        self.assertRaises(ValidationError, self.do_update_AAAA_record, **{'record': rec0, 'new_name': "%asdfsaf", 'new_ip': osu_block})
        self.assertRaises(ValidationError, self.do_update_AAAA_record, **{'record': rec0, 'new_name': "sdfsa", 'new_ip': 1239812472934623847})
        self.assertRaises(ValidationError, self.do_update_AAAA_record, **{'record': rec0, 'new_name': None, 'new_ip': "128.193.1.1"})
        self.assertRaises(ValidationError, self.do_update_AAAA_record, **{'record': rec0, 'new_name': "%asdfsaf", 'new_ip': osu_block + ":1"})
        self.assertRaises(ValidationError, self.do_update_AAAA_record, **{'record': rec0, 'new_name': " sdfsa ", 'new_ip': None})
コード例 #6
0
    def test_add_AAAA_records_exist(self):
        osu_block = "9620:105:F000:"
        boot_strap_ipv6_reverse_domain("9.6.2.0")

        data = {'label': 'new', 'domain': self.f_o_e, 'ip': osu_block + ":2"}
        self.do_add_record6(data)
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'new', 'domain': self.f_o_e, 'ip': osu_block + ":0:9"}
        self.do_add_record6(data)
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'nope', 'domain': self.o_e, 'ip': osu_block + ":4"}
        self.do_add_record6(data)
        self.assertRaises(ValidationError, self.do_add_record6, data)
コード例 #7
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
    def test_add_AAAA_records_exist(self):
        osu_block = "9620:105:F000:"
        boot_strap_ipv6_reverse_domain("9.6.2.0")

        data = {'label': 'new', 'domain': self.f_o_e, 'ip': osu_block + ":2"}
        self.do_add_record6(data)
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'new', 'domain': self.f_o_e, 'ip':
                osu_block + ":0:9"}
        self.do_add_record6(data)
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'nope', 'domain': self.o_e, 'ip': osu_block + ":4"}
        self.do_add_record6(data)
        self.assertRaises(ValidationError, self.do_add_record6, data)
コード例 #8
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
 def test_remove_AAAA_address_records(self):
     osu_block = "4620:105:F000:"
     boot_strap_ipv6_reverse_domain("4.6.2.0")
     self.do_remove_AAAA_record("", self.o_e, osu_block + ":1")
     self.do_remove_AAAA_record("please", self.o_e, osu_block + ":2")
     self.do_remove_AAAA_record("visit", self.o_e, osu_block + ":4")
     self.do_remove_AAAA_record("from", self.o_e, osu_block + ":2")
     self.do_remove_AAAA_record("either", self.o_e, osu_block + ":1")
     self.do_remove_AAAA_record("webpages", self.o_e, osu_block + ":1")
     self.do_remove_AAAA_record("read", self.o_e, osu_block + ":1")
     self.do_remove_AAAA_record("", self.f_o_e, osu_block + ":1")
     self.do_remove_AAAA_record("please", self.f_o_e, osu_block + ":2")
     self.do_remove_AAAA_record("visit", self.f_o_e, osu_block + ":4")
     self.do_remove_AAAA_record("from", self.f_o_e, osu_block + ":2")
     self.do_remove_AAAA_record("either", self.f_o_e, osu_block + ":1")
     self.do_remove_AAAA_record("webpages", self.f_o_e, osu_block + ":1")
     self.do_remove_AAAA_record("read", self.f_o_e, osu_block + ":1")
コード例 #9
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
 def test_remove_AAAA_address_records(self):
     osu_block = "4620:105:F000:"
     boot_strap_ipv6_reverse_domain("4.6.2.0")
     self.do_remove_AAAA_record("", self.o_e, osu_block + ":1")
     self.do_remove_AAAA_record("please", self.o_e, osu_block + ":2")
     self.do_remove_AAAA_record("visit", self.o_e, osu_block + ":4")
     self.do_remove_AAAA_record("from", self.o_e, osu_block + ":2")
     self.do_remove_AAAA_record("either", self.o_e, osu_block + ":1")
     self.do_remove_AAAA_record("webpages", self.o_e, osu_block + ":1")
     self.do_remove_AAAA_record("read", self.o_e, osu_block + ":1")
     self.do_remove_AAAA_record("", self.f_o_e, osu_block + ":1")
     self.do_remove_AAAA_record("please", self.f_o_e, osu_block + ":2")
     self.do_remove_AAAA_record("visit", self.f_o_e, osu_block + ":4")
     self.do_remove_AAAA_record("from", self.f_o_e, osu_block + ":2")
     self.do_remove_AAAA_record("either", self.f_o_e, osu_block + ":1")
     self.do_remove_AAAA_record("webpages", self.f_o_e, osu_block + ":1")
     self.do_remove_AAAA_record("read", self.f_o_e, osu_block + ":1")
コード例 #10
0
ファイル: test_models.py プロジェクト: alecdhuse/cyder
    def test_ipv6_str(self):
        boot_strap_ipv6_reverse_domain('1.2.3.4')

        ip_str = '1234:1234:1243:1243:1243::'
        new_ip = Ip(ip_str=ip_str, ip_type='6')
        new_ip.clean_ip()

        ip_upper, ip_lower = ipv6_to_longs(ip_str)
        self.assertEqual(new_ip.ip_upper, ip_upper)
        self.assertEqual(new_ip.ip_lower, ip_lower)

        ip_str = '1234:432:3:0:3414:22::'
        new_ip = Ip(ip_str=ip_str, ip_type='6')
        new_ip.clean_ip()

        ip_upper, ip_lower = ipv6_to_longs(ip_str)
        self.assertEqual(new_ip.ip_upper, ip_upper)
        self.assertEqual(new_ip.ip_lower, ip_lower)
コード例 #11
0
    def test_ipv6_str(self):
        boot_strap_ipv6_reverse_domain('1.2.3.4')

        ip_str = '1234:1234:1243:1243:1243::'
        new_ip = Ip(ip_str=ip_str, ip_type='6')
        new_ip.clean_ip()

        ip_upper, ip_lower = ipv6_to_longs(ip_str)
        self.assertEqual(new_ip.ip_upper, ip_upper)
        self.assertEqual(new_ip.ip_lower, ip_lower)

        ip_str = '1234:432:3:0:3414:22::'
        new_ip = Ip(ip_str=ip_str, ip_type='6')
        new_ip.clean_ip()

        ip_upper, ip_lower = ipv6_to_longs(ip_str)
        self.assertEqual(new_ip.ip_upper, ip_upper)
        self.assertEqual(new_ip.ip_lower, ip_lower)
コード例 #12
0
ファイル: test_reverse.py プロジェクト: Ziaunys/chili
    def test_add_remove_reverse_ipv6_domains(self):
        osu_block = "2620:105:F000"
        rd0 = boot_strap_ipv6_reverse_domain("2.6.2.0.0.1.0.5.f.0.0.0")

        ip1 = self.add_ptr_ipv6(osu_block + ":8000::1")
        self.assertEqual(ip1.reverse_domain, rd0)
        ip2 = self.add_ptr_ipv6(osu_block + ":8000::2")
        self.assertEqual(ip2.reverse_domain, rd0)
        ip3 = self.add_ptr_ipv6(osu_block + ":8000::3")
        self.assertEqual(ip3.reverse_domain, rd0)
        ip4 = self.add_ptr_ipv6(osu_block + ":8000::4")

        rd1 = self.create_domain(name="2.6.2.0.0.1.0.5.f.0.0.0.8", ip_type='6')
        rd1.save()
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::1")
        ptr1 = PTR.objects.filter(ip_upper=ip_upper,
                                  ip_lower=ip_lower,
                                  ip_type='6')[0]
        self.assertEqual(ptr1.reverse_domain, rd1)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::2")
        ptr2 = PTR.objects.filter(ip_upper=ip_upper,
                                  ip_lower=ip_lower,
                                  ip_type='6')[0]
        self.assertEqual(ptr2.reverse_domain, rd1)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::3")
        ptr3 = PTR.objects.filter(ip_upper=ip_upper,
                                  ip_lower=ip_lower,
                                  ip_type='6')[0]
        self.assertEqual(ptr3.reverse_domain, rd1)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::4")
        ptr4 = PTR.objects.filter(ip_upper=ip_upper,
                                  ip_lower=ip_lower,
                                  ip_type='6')[0]
        self.assertEqual(ptr4.reverse_domain, rd1)

        rd1.delete()

        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::1")
        ptr1 = PTR.objects.filter(ip_upper=ip_upper,
                                  ip_lower=ip_lower,
                                  ip_type='6')[0]
        self.assertEqual(ptr1.reverse_domain, rd0)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::2")
        ptr2 = PTR.objects.filter(ip_upper=ip_upper,
                                  ip_lower=ip_lower,
                                  ip_type='6')[0]
        self.assertEqual(ptr2.reverse_domain, rd0)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::3")
        ptr3 = PTR.objects.filter(ip_upper=ip_upper,
                                  ip_lower=ip_lower,
                                  ip_type='6')[0]
        self.assertEqual(ptr3.reverse_domain, rd0)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::4")
        ptr4 = PTR.objects.filter(ip_upper=ip_upper,
                                  ip_lower=ip_lower,
                                  ip_type='6')[0]
        self.assertEqual(ptr4.reverse_domain, rd0)
コード例 #13
0
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()
        self.i6_arpa = self.create_domain(name='ipv6.arpa')
        self.i6_arpa.save()

        self._128 = self.create_domain(name='128', ip_type='4')
        self._128.save()
        boot_strap_ipv6_reverse_domain("8.6.2.0")
        self.osu_block = "8620:105:F000:"
        self.o = Domain(name="edu")
        self.o.save()
        self.o_e = Domain(name="oregonstate.edu")
        self.o_e.save()
        self.b_o_e = Domain(name="bar.oregonstate.edu")
        self.b_o_e.save()
コード例 #14
0
ファイル: test_models.py プロジェクト: alecdhuse/cyder
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()
        self.i6_arpa = self.create_domain(name='ip6.arpa')
        self.i6_arpa.save()

        self._128 = self.create_domain(name='128', ip_type='4')
        self._128.save()
        boot_strap_ipv6_reverse_domain("8.6.2.0")
        self.osu_block = "8620:105:F000:"
        self.o = Domain(name="edu")
        self.o.save()
        self.o_e = Domain(name="oregonstate.edu")
        self.o_e.save()
        self.b_o_e = Domain(name="bar.oregonstate.edu")
        self.b_o_e.save()
コード例 #15
0
 def test_int_ip(self):
     rd = self.create_domain(name='129', ip_type='4')
     rd.save()
     ip = Ip(ip_str="129.193.1.1", ip_type='4')
     ip.clean_ip()
     ip.__int__()
     ip.__repr__()
     rd = boot_strap_ipv6_reverse_domain('e')
     ip_str = 'efff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
     ip = Ip(ip_str=ip_str, ip_type='6')
     ip.clean_ip()
     ip.__int__()
     ip.__repr__()
コード例 #16
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
 def test_int_ip(self):
     rd = self.create_domain(name='129', ip_type='4')
     rd.save()
     ip = Ip(ip_str="129.193.1.1", ip_type='4')
     ip.clean_ip()
     ip.__int__()
     ip.__repr__()
     rd = boot_strap_ipv6_reverse_domain('e')
     ip_str = 'efff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
     ip = Ip(ip_str=ip_str, ip_type='6')
     ip.clean_ip()
     ip.__int__()
     ip.__repr__()
コード例 #17
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
 def test_add_AAAA_address_records(self):
     osu_block = "2620:105:F000:"
     boot_strap_ipv6_reverse_domain("2.6.2.0")
     data = {'label': '', 'domain': self.f_o_e, 'ip': osu_block + ":4"}
     self.do_add_record6(data)
     data = {'label': '', 'domain': self.o_e, 'ip': osu_block + ":1"}
     self.do_add_record6(data)
     data = {'label': '6ba-r', 'domain': self.o_e, 'ip': osu_block + ":6"}
     self.do_add_record6(data)
     data = {'label': '6ba-r', 'domain': self.f_o_e, 'ip': osu_block + ":7"}
     self.do_add_record6(data)
     data = {'label': '6foo', 'domain': self.f_o_e, 'ip': osu_block + ":5"}
     self.do_add_record6(data)
     data = {'label': '6foo', 'domain': self.o_e, 'ip': osu_block + ":3"}
     self.do_add_record6(data)
     data = {'label': '6ba3z', 'domain': self.o_e, 'ip': osu_block + ":4"}
     self.do_add_record6(data)
     data = {'label': '6ba3z', 'domain': self.f_o_e, 'ip': osu_block + ":6"}
     self.do_add_record6(data)
     data = {
         'label': '6foob1ar',
         'domain': self.o_e,
         'ip': osu_block + ":5"
     }
     self.do_add_record6(data)
     data = {
         'label': '6foob1ar',
         'domain': self.f_o_e,
         'ip': osu_block + ":8"
     }
     self.do_add_record6(data)
     data = {
         'label': '23412341253254243',
         'domain': self.f_o_e,
         'ip': osu_block + ":8"
     }
     self.do_add_record6(data)
コード例 #18
0
ファイル: test_reverse.py プロジェクト: Ziaunys/chili
    def test_add_remove_reverse_ipv6_domains(self):
        osu_block = "2620:105:F000"
        rd0 = boot_strap_ipv6_reverse_domain("2.6.2.0.0.1.0.5.f.0.0.0")

        ip1 = self.add_ptr_ipv6(osu_block + ":8000::1")
        self.assertEqual(ip1.reverse_domain, rd0)
        ip2 = self.add_ptr_ipv6(osu_block + ":8000::2")
        self.assertEqual(ip2.reverse_domain, rd0)
        ip3 = self.add_ptr_ipv6(osu_block + ":8000::3")
        self.assertEqual(ip3.reverse_domain, rd0)
        ip4 = self.add_ptr_ipv6(osu_block + ":8000::4")

        rd1 = self.create_domain(name="2.6.2.0.0.1.0.5.f.0.0.0.8", ip_type='6')
        rd1.save()
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::1")
        ptr1 = PTR.objects.filter(
            ip_upper=ip_upper, ip_lower=ip_lower, ip_type='6')[0]
        self.assertEqual(ptr1.reverse_domain, rd1)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::2")
        ptr2 = PTR.objects.filter(
            ip_upper=ip_upper, ip_lower=ip_lower, ip_type='6')[0]
        self.assertEqual(ptr2.reverse_domain, rd1)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::3")
        ptr3 = PTR.objects.filter(
            ip_upper=ip_upper, ip_lower=ip_lower, ip_type='6')[0]
        self.assertEqual(ptr3.reverse_domain, rd1)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::4")
        ptr4 = PTR.objects.filter(
            ip_upper=ip_upper, ip_lower=ip_lower, ip_type='6')[0]
        self.assertEqual(ptr4.reverse_domain, rd1)

        rd1.delete()

        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::1")
        ptr1 = PTR.objects.filter(
            ip_upper=ip_upper, ip_lower=ip_lower, ip_type='6')[0]
        self.assertEqual(ptr1.reverse_domain, rd0)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::2")
        ptr2 = PTR.objects.filter(
            ip_upper=ip_upper, ip_lower=ip_lower, ip_type='6')[0]
        self.assertEqual(ptr2.reverse_domain, rd0)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::3")
        ptr3 = PTR.objects.filter(
            ip_upper=ip_upper, ip_lower=ip_lower, ip_type='6')[0]
        self.assertEqual(ptr3.reverse_domain, rd0)
        ip_upper, ip_lower = ipv6_to_longs(osu_block + ":8000::4")
        ptr4 = PTR.objects.filter(
            ip_upper=ip_upper, ip_lower=ip_lower, ip_type='6')[0]
        self.assertEqual(ptr4.reverse_domain, rd0)
コード例 #19
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
    def test_add_AAAA_invalid_address_records(self):
        osu_block = "3620:105:F000:"
        boot_strap_ipv6_reverse_domain("3.6.2.0")

        data = {'label': 'foo.nas', 'domain': self.o_e, 'ip': osu_block + ":1"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {
            'label': 'foo.bar.nas',
            'domain': self.o_e,
            'ip': osu_block + ":2"
        }
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {
            'label': 'foo.baz.bar.nas',
            'domain': self.o_e,
            'ip': osu_block + ":3"
        }
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'n as', 'domain': self.o_e, 'ip': osu_block + ":4"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {
            'label': 'n!+/*&%$#@as',
            'domain': self.o_e,
            'ip': osu_block + ":5"
        }
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'n%as', 'domain': self.o_e, 'ip': osu_block + ":6"}
        self.assertRaises(ValidationError, self.do_add_record6, data)

        data = {'label': 'n+as', 'domain': self.o_e, 'ip': osu_block + ":7"}
        self.assertRaises(ValidationError, self.do_add_record6, data)
コード例 #20
0
ファイル: test_models.py プロジェクト: alecdhuse/cyder
 def test_large_ipv6(self):
     try:
         rd = boot_strap_ipv6_reverse_domain('f')
         rd.save()
     except ValidationError:
         pass
     ip_str = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
     ip = ipaddr.IPv6Address(ip_str)
     ip_upper, ip_lower = ipv6_to_longs(ip_str)
     self.assertEqual(ip.__int__(), (2 ** 64) * ip_upper + ip_lower)
     new_ip = Ip(ip_str=ip_str, ip_upper=ip_upper,
                 ip_lower=ip_lower, ip_type='6')
     new_ip.clean_ip()
     self.assertEqual(ip_str, new_ip.ip_str)
     self.assertEqual(ip.__int__(), new_ip.__int__())
コード例 #21
0
 def test_large_ipv6(self):
     try:
         rd = boot_strap_ipv6_reverse_domain('f')
         rd.save()
     except ValidationError:
         pass
     ip_str = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
     ip = ipaddr.IPv6Address(ip_str)
     ip_upper, ip_lower = ipv6_to_longs(ip_str)
     self.assertEqual(ip.__int__(), (2**64) * ip_upper + ip_lower)
     new_ip = Ip(ip_str=ip_str,
                 ip_upper=ip_upper,
                 ip_lower=ip_lower,
                 ip_type='6')
     new_ip.clean_ip()
     self.assertEqual(ip_str, new_ip.ip_str)
     self.assertEqual(ip.__int__(), new_ip.__int__())
コード例 #22
0
ファイル: test_reverse.py プロジェクト: Ziaunys/chili
        e = None
        try:
            self.create_domain(name='2.6.2.1.1.0.5.F.0.0.0.d.e.a.d.b.e.e.f',
                               ip_type='6').save()
        except ValidationError, e:
            pass
        self.assertEqual(ValidationError, type(e))
        e = None
        try:
            self.create_domain(name=test_dname, ip_type='6').save()
        except ValidationError, e:
            pass
        self.assertEqual(ValidationError, type(e))
        e = None
        # These should pass
        boot_strap_ipv6_reverse_domain('7.6.2.4')
        boot_strap_ipv6_reverse_domain('6.6.2.5.1')
        # These are pretty unrealistic since they prodtrude into the host part of the address.
        boot_strap_ipv6_reverse_domain(
            '4.6.2.2.1.0.5.3.f.0.0.0.1.2.3.4.1.2.3.4.1.2.3.4.1.2.3.4.1.2.3.4')
        boot_strap_ipv6_reverse_domain(
            '5.6.2.3.1.0.5.3.f.0.0.0.1.2.3.4.1.2.3.4.1.2.3.4')

    def test_add_reverse_domainless_ips(self):
        e = None
        try:
            self.add_ptr_ipv4('8.8.8.8')
        except ValidationError, e:
            pass
        self.assertEqual(ValidationError, type(e))
        e = None
コード例 #23
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
 def test_large_ipv6(self):
     try:
         rd = boot_strap_ipv6_reverse_domain('f')
         rd.save()
     except ValidationError, e:
         pass
コード例 #24
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()
        self.i6_arpa = self.create_domain(name='ipv6.arpa')
        self.i6_arpa.save()

        self.osu_block = "633:105:F000:"
        boot_strap_ipv6_reverse_domain("0.6.3")
        try:
            self.e = Domain(name='edu')
            self.e.save()
        except IntegrityError:
            pass
        try:
            self.o_e = Domain(name='oregonstate.edu')
            self.o_e.save()
        except IntegrityError:
            self.o_e = Domain.objects.filter(name='oregonstate.edu')[0]
            pass

        try:
            self.f_o_e = Domain(name='foo.oregonstate.edu')
            self.f_o_e.save()
        except IntegrityError:
            self.f_o_e = Domain.objects.filter(name='foo.oregonstate.edu')[0]
            pass

        try:
            self.m_o_e = Domain(name='max.oregonstate.edu')
            self.m_o_e.save()
        except IntegrityError:
            self.m_o_e = Domain.objects.filter(name='max.oregonstate.edu')[0]
            pass

        try:
            self.z_o_e = Domain(name='zax.oregonstate.edu')
            self.z_o_e.save()
        except IntegrityError:
            self.z_o_e = Domain.objects.filter(name='zax.oregonstate.edu')[0]
            pass
        try:
            self.g_o_e = Domain(name='george.oregonstate.edu')
            self.g_o_e.save()
        except IntegrityError:
            self.g_o_e = Domain.objects.filter(
                name='george.oregonstate.edu')[0]
            pass

        try:
            self._128 = self.create_domain(name='128')
            self._128.save()
        except IntegrityError:
            raise Exception
            self._128 = self.create_domain.objects.filter(name='128')[0]
            pass

        try:
            self._128_193 = self.create_domain(name='128.193')
            self._128_193.save()
        except IntegrityError:
            raise Exception
            self._128_193 = Domain.objects.filter(name='128.193')[0]
            pass
コード例 #25
0
ファイル: test_reverse.py プロジェクト: Ziaunys/chili
        e = None
        try:
            self.create_domain(name='2.6.2.1.1.0.5.F.0.0.0.d.e.a.d.b.e.e.f',
                               ip_type='6').save()
        except ValidationError, e:
            pass
        self.assertEqual(ValidationError, type(e))
        e = None
        try:
            self.create_domain(name=test_dname, ip_type='6').save()
        except ValidationError, e:
            pass
        self.assertEqual(ValidationError, type(e))
        e = None
        # These should pass
        boot_strap_ipv6_reverse_domain('7.6.2.4')
        boot_strap_ipv6_reverse_domain('6.6.2.5.1')
        # These are pretty unrealistic since they prodtrude into the host part of the address.
        boot_strap_ipv6_reverse_domain(
            '4.6.2.2.1.0.5.3.f.0.0.0.1.2.3.4.1.2.3.4.1.2.3.4.1.2.3.4.1.2.3.4')
        boot_strap_ipv6_reverse_domain(
            '5.6.2.3.1.0.5.3.f.0.0.0.1.2.3.4.1.2.3.4.1.2.3.4')

    def test_add_reverse_domainless_ips(self):
        e = None
        try:
            self.add_ptr_ipv4('8.8.8.8')
        except ValidationError, e:
            pass
        self.assertEqual(ValidationError, type(e))
        e = None
コード例 #26
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
 def test_large_ipv6(self):
     try:
         rd = boot_strap_ipv6_reverse_domain('f')
         rd.save()
     except ValidationError, e:
         pass
コード例 #27
0
ファイル: test_models.py プロジェクト: Ziaunys/chili
    def setUp(self):
        self.arpa = self.create_domain(name='arpa')
        self.arpa.save()
        self.i_arpa = self.create_domain(name='in-addr.arpa')
        self.i_arpa.save()
        self.i6_arpa = self.create_domain(name='ipv6.arpa')
        self.i6_arpa.save()

        self.osu_block = "633:105:F000:"
        boot_strap_ipv6_reverse_domain("0.6.3")
        try:
            self.e = Domain(name='edu')
            self.e.save()
        except IntegrityError:
            pass
        try:
            self.o_e = Domain(name='oregonstate.edu')
            self.o_e.save()
        except IntegrityError:
            self.o_e = Domain.objects.filter(name='oregonstate.edu')[0]
            pass

        try:
            self.f_o_e = Domain(name='foo.oregonstate.edu')
            self.f_o_e.save()
        except IntegrityError:
            self.f_o_e = Domain.objects.filter(name='foo.oregonstate.edu')[0]
            pass

        try:
            self.m_o_e = Domain(name='max.oregonstate.edu')
            self.m_o_e.save()
        except IntegrityError:
            self.m_o_e = Domain.objects.filter(name='max.oregonstate.edu')[0]
            pass

        try:
            self.z_o_e = Domain(name='zax.oregonstate.edu')
            self.z_o_e.save()
        except IntegrityError:
            self.z_o_e = Domain.objects.filter(name='zax.oregonstate.edu')[0]
            pass
        try:
            self.g_o_e = Domain(name='george.oregonstate.edu')
            self.g_o_e.save()
        except IntegrityError:
            self.g_o_e = Domain.objects.filter(
                name='george.oregonstate.edu')[0]
            pass

        try:
            self._128 = self.create_domain(name='128')
            self._128.save()
        except IntegrityError:
            raise Exception
            self._128 = self.create_domain.objects.filter(name='128')[0]
            pass

        try:
            self._128_193 = self.create_domain(name='128.193')
            self._128_193.save()
        except IntegrityError:
            raise Exception
            self._128_193 = Domain.objects.filter(name='128.193')[0]
            pass