def test_duplicate_vrf_unique(self):
    vrf = VRF.objects.create(name='Test', rd='1:1', enforce_unique=True)
    IPAddress.objects.create(vrf=vrf, address=netaddr.IPNetwork('192.0.2.1/24'))
    duplicate_ip = IPAddress(vrf=vrf, address=netaddr.IPNetwork('192.0.2.1/24'))
    self.assertRaises(ValidationError, duplicate_ip.clean)
def test_duplicate_vrf_unique(self):
    vrf = VRF.objects.create(name='Test', rd='1:1', enforce_unique=True)
    IPAddress.objects.create(vrf=vrf, address=netaddr.IPNetwork('192.0.2.1/24'))
    duplicate_ip = IPAddress(vrf=vrf, address=netaddr.IPNetwork('192.0.2.1/24'))
    self.assertRaises(ValidationError, duplicate_ip.clean)