'Populate the test database with some hosts and labels.'

def _fill_in_test_data(self):

    if models.DroneSet.drone_sets_enabled():
        models.DroneSet.objects.create(name=models.DroneSet.default_drone_set_name())
    acl_group = models.AclGroup.objects.create(name='my_acl')
    acl_group.users.add(models.User.current_user())
    self.hosts = [models.Host.objects.create(hostname=hostname) for hostname in ('host1', 'host2', 'host3', 'host4', 'host5', 'host6', 'host7', 'host8', 'host9')]
    acl_group.hosts = self.hosts
    models.AclGroup.smart_get('Everyone').hosts = []
    self.labels = [models.Label.objects.create(name=name) for name in ('label1', 'label2', 'label3', 'label4', 'label5', 'label6', 'label7', 'label8')]
    platform = models.Label.objects.create(name='myplatform', platform=True)
    for host in self.hosts:
        host.labels.add(platform)
    atomic_group1 = models.AtomicGroup.objects.create(name='atomic1', max_number_of_machines=2)
    atomic_group2 = models.AtomicGroup.objects.create(name='atomic2', max_number_of_machines=2)
    self.label3 = self.labels[2]
    self.label3.only_if_needed = True
    self.label3.save()
    self.label4 = self.labels[3]
    self.label4.atomic_group = atomic_group1
    self.label4.save()
    self.label5 = self.labels[4]
    self.label5.atomic_group = atomic_group1
    self.label5.save()
    self.hosts[0].labels.add(self.labels[0])
    self.hosts[1].labels.add(self.labels[1])
    self.label6 = self.labels[5]
    self.label7 = self.labels[6]
    self.label8 = self.labels[7]
    self.label8.atomic_group = atomic_group2
    self.label8.save()
    for hostnum in xrange(4, 7):
        self.hosts[hostnum].labels.add(self.label4)
        self.hosts[hostnum].labels.add(self.label6)
    self.hosts[6].labels.add(self.label7)
    for hostnum in xrange(7, 9):
        self.hosts[hostnum].labels.add(self.label5)
        self.hosts[hostnum].labels.add(self.label6)
        self.hosts[hostnum].labels.add(self.label7)
