Ejemplo n.º 1
0
 def test_delete(self):
     user = factory.make_User()
     factory.make_Subnet(cidr="192.168.0.0/24")
     handler = IPRangeHandler(user, {}, None)
     ip_range = handler.create({
         "type": "reserved",
         "start_ip": "192.168.0.10",
         "end_ip": "192.168.0.20",
     })
     handler.delete(ip_range)
     self.assertIsNone(get_one(IPRange.objects.filter(id=ip_range["id"])))
Ejemplo n.º 2
0
 def test_create(self):
     user = factory.make_User()
     factory.make_Subnet(cidr="192.168.0.0/24")
     handler = IPRangeHandler(user, {})
     ip_range = handler.create({
         "type": "reserved",
         "start_ip": "192.168.0.10",
         "end_ip": "192.168.0.20",
     })
     self.assertThat(
         IPRange.objects.get(id=ip_range['id']),
         MatchesStructure.byEquality(
             type="reserved", start_ip="192.168.0.10",
             end_ip="192.168.0.20"))