Ejemplo n.º 1
0
    def test_model(self):
        fake_cluster = FakerModelCollector()
        model = fake_cluster.generate_scenario_1()

        self.assertEqual(len(model._hypervisors), 5)
        self.assertEqual(len(model._vms), 35)
        self.assertEqual(len(model.get_mapping().get_mapping()), 5)
Ejemplo n.º 2
0
    def test_model(self):
        fake_cluster = FakerModelCollector()
        model = fake_cluster.generate_scenario_1()

        self.assertEqual(len(model._hypervisors), 5)
        self.assertEqual(len(model._vms), 35)
        self.assertEqual(len(model.get_mapping().get_mapping()), 5)
Ejemplo n.º 3
0
    def test_trigger_audit(self, mock_collector):
        mock_collector.return_value = FakerModelCollector()
        audit_uuid = utils.generate_uuid()
        audit_handler = DefaultAuditHandler(mock.MagicMock())
        endpoint = AuditEndpoint(audit_handler, max_workers=2)

        with mock.patch.object(DefaultAuditHandler, 'execute') \
                as mock_call:
            mock_call.return_value = 0
            endpoint.trigger_audit(audit_handler, audit_uuid)

        mock_call.assert_called_once_with(audit_uuid, audit_handler)
Ejemplo n.º 4
0
 def test_vm_from_id_raise(self):
     fake_cluster = FakerModelCollector()
     model = fake_cluster.generate_scenario_1()
     self.assertRaises(exception.InstanceNotFound,
                       model.get_vm_from_id, "valeur_qcq")
Ejemplo n.º 5
0
 def test_vm_from_id_raise(self):
     fake_cluster = FakerModelCollector()
     model = fake_cluster.generate_scenario_1()
     self.assertRaises(exception.InstanceNotFound, model.get_vm_from_id,
                       "valeur_qcq")