예제 #1
0
 def test__silent_when_no_node(self):
     event_type = factory.make_EventType()
     description = factory.make_name('description')
     # Exception should not be raised.
     events.send_event_ip_address(factory.make_ip_address(),
                                  event_type.name, description,
                                  datetime.datetime.utcnow())
예제 #2
0
 def test_creates_event_for_node_with_bridge_interface(self):
     event_type = factory.make_EventType()
     node = factory.make_Node(interface=True)
     eth0 = node.get_boot_interface()
     # Create a bridge with the same MAC as the boot interface.
     factory.make_Interface(
         INTERFACE_TYPE.BRIDGE,
         node=node,
         mac_address=eth0.mac_address,
         parents=[node.get_boot_interface()],
     )
     description = factory.make_name("description")
     timestamp = datetime.datetime.utcnow()
     ip = factory.make_StaticIPAddress()
     for interface in node.interface_set.all():
         ip.interface_set.add(interface)
     events.send_event_ip_address(ip.ip, event_type.name, description,
                                  timestamp)
     # Doesn't raise a DoesNotExist error.
     Event.objects.get(
         node=node,
         type=event_type,
         description=description,
         created=timestamp,
     )
예제 #3
0
 def test__creates_event_for_node(self):
     event_type = factory.make_EventType()
     node = factory.make_Node(interface=True)
     description = factory.make_name('description')
     timestamp = datetime.datetime.utcnow()
     ip = factory.make_StaticIPAddress(interface=node.interface_set.first())
     events.send_event_ip_address(ip.ip, event_type.name, description,
                                  timestamp)
     # Doesn't raise a DoesNotExist error.
     Event.objects.get(node=node,
                       type=event_type,
                       description=description,
                       created=timestamp)