Пример #1
0
 def test_works_with_multiple_entries_in_queryset(self):
     # Regression test for lp:1551399
     vlan = factory.make_VLAN()
     node = factory.make_Node_with_Interface_on_Subnet(vlan=vlan)
     factory.make_Interface(node=node, vlan=vlan)
     qs = Node.objects.filter_by_vids([vlan.vid])
     node_field = NodeChoiceField(qs)
     # Double check that we have duplicated entires
     self.assertEqual(2, len(qs.filter(system_id=node.system_id)))
     self.assertEqual(node, node_field.clean(node.system_id))
Пример #2
0
 def test_allows_selecting_by_hostname(self):
     node = factory.make_Node()
     for _ in range(3):
         factory.make_Node()
     node_field = NodeChoiceField(Node.objects.filter())
     self.assertEqual(node, node_field.clean(node.hostname))