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_mac_address(factory.make_mac_address(), event_type.name, description, datetime.datetime.utcnow())
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() mac_address = node.interface_set.first().mac_address events.send_event_mac_address(mac_address, event_type.name, description, timestamp) # Doesn't raise a DoesNotExist error. Event.objects.get(node=node, type=event_type, description=description, created=timestamp)