Example #1
0
 def test_add_hypervisor(self):
     model = ModelRoot()
     id = "{0}".format(uuid.uuid4())
     hypervisor = Hypervisor()
     hypervisor.uuid = id
     model.add_hypervisor(hypervisor)
     self.assertEqual(model.get_hypervisor_from_id(id), hypervisor)
Example #2
0
 def test_add_hypervisor(self):
     model = ModelRoot()
     id = "{0}".format(uuid.uuid4())
     hypervisor = Hypervisor()
     hypervisor.uuid = id
     model.add_hypervisor(hypervisor)
     self.assertEqual(model.get_hypervisor_from_id(id), hypervisor)
Example #3
0
 def test_assert_hypervisor_raise(self):
     model = ModelRoot()
     id = "{0}".format(uuid.uuid4())
     hypervisor = Hypervisor()
     hypervisor.uuid = id
     model.add_hypervisor(hypervisor)
     self.assertRaises(IllegalArgumentException,
                       model.assert_hypervisor, "objet_qcq")
Example #4
0
 def test_assert_hypervisor_raise(self):
     model = ModelRoot()
     id = "{0}".format(uuid.uuid4())
     hypervisor = Hypervisor()
     hypervisor.uuid = id
     model.add_hypervisor(hypervisor)
     self.assertRaises(IllegalArgumentException, model.assert_hypervisor,
                       "objet_qcq")
Example #5
0
    def test_hypervisor_from_id_raise(self):
        model = ModelRoot()
        id = "{0}".format(uuid.uuid4())
        hypervisor = Hypervisor()
        hypervisor.uuid = id
        model.add_hypervisor(hypervisor)

        id2 = "{0}".format(uuid.uuid4())
        self.assertRaises(exception.HypervisorNotFound,
                          model.get_hypervisor_from_id, id2)
Example #6
0
    def test_hypervisor_from_id_raise(self):
        model = ModelRoot()
        id = "{0}".format(uuid.uuid4())
        hypervisor = Hypervisor()
        hypervisor.uuid = id
        model.add_hypervisor(hypervisor)

        id2 = "{0}".format(uuid.uuid4())
        self.assertRaises(exception.HypervisorNotFound,
                          model.get_hypervisor_from_id, id2)
Example #7
0
    def test_set_get_state_hypervisors(self):
        model = ModelRoot()
        id = "{0}".format(uuid.uuid4())
        hypervisor = Hypervisor()
        hypervisor.uuid = id
        model.add_hypervisor(hypervisor)

        self.assertIsInstance(hypervisor.state, HypervisorState)

        hyp = model.get_hypervisor_from_id(id)
        hyp.state = HypervisorState.OFFLINE
        self.assertIsInstance(hyp.state, HypervisorState)
Example #8
0
    def test_set_get_state_hypervisors(self):
        model = ModelRoot()
        id = "{0}".format(uuid.uuid4())
        hypervisor = Hypervisor()
        hypervisor.uuid = id
        model.add_hypervisor(hypervisor)

        self.assertIsInstance(hypervisor.state, HypervisorState)

        hyp = model.get_hypervisor_from_id(id)
        hyp.state = HypervisorState.OFFLINE
        self.assertIsInstance(hyp.state, HypervisorState)
Example #9
0
    def test_remove_hypervisor_raise(self):
        model = ModelRoot()
        id = "{0}".format(uuid.uuid4())
        hypervisor = Hypervisor()
        hypervisor.uuid = id
        model.add_hypervisor(hypervisor)

        id2 = "{0}".format(uuid.uuid4())
        hypervisor2 = Hypervisor()
        hypervisor2.uuid = id2

        self.assertRaises(exception.HypervisorNotFound,
                          model.remove_hypervisor, hypervisor2)
Example #10
0
    def test_remove_hypervisor_raise(self):
        model = ModelRoot()
        id = "{0}".format(uuid.uuid4())
        hypervisor = Hypervisor()
        hypervisor.uuid = id
        model.add_hypervisor(hypervisor)

        id2 = "{0}".format(uuid.uuid4())
        hypervisor2 = Hypervisor()
        hypervisor2.uuid = id2

        self.assertRaises(exception.HypervisorNotFound,
                          model.remove_hypervisor, hypervisor2)
Example #11
0
 def test_get_all_hypervisors(self):
     model = ModelRoot()
     for i in range(10):
         id = "{0}".format(uuid.uuid4())
         hypervisor = Hypervisor()
         hypervisor.uuid = id
         model.add_hypervisor(hypervisor)
     all_hypervisors = model.get_all_hypervisors()
     for id in all_hypervisors:
         hyp = model.get_hypervisor_from_id(id)
         model.assert_hypervisor(hyp)
Example #12
0
 def test_delete_hypervisor(self):
     model = ModelRoot()
     id = "{0}".format(uuid.uuid4())
     hypervisor = Hypervisor()
     hypervisor.uuid = id
     model.add_hypervisor(hypervisor)
     self.assertEqual(model.get_hypervisor_from_id(id), hypervisor)
     model.remove_hypervisor(hypervisor)
     self.assertRaises(exception.HypervisorNotFound,
                       model.get_hypervisor_from_id, id)
Example #13
0
 def test_get_all_hypervisors(self):
     model = ModelRoot()
     for i in range(10):
         id = "{0}".format(uuid.uuid4())
         hypervisor = Hypervisor()
         hypervisor.uuid = id
         model.add_hypervisor(hypervisor)
     all_hypervisors = model.get_all_hypervisors()
     for id in all_hypervisors:
         hyp = model.get_hypervisor_from_id(id)
         model.assert_hypervisor(hyp)
Example #14
0
 def test_delete_hypervisor(self):
     model = ModelRoot()
     id = "{0}".format(uuid.uuid4())
     hypervisor = Hypervisor()
     hypervisor.uuid = id
     model.add_hypervisor(hypervisor)
     self.assertEqual(model.get_hypervisor_from_id(id), hypervisor)
     model.remove_hypervisor(hypervisor)
     self.assertRaises(exception.HypervisorNotFound,
                       model.get_hypervisor_from_id, id)
Example #15
0
 def test_assert_vm_raise(self):
     model = ModelRoot()
     self.assertRaises(IllegalArgumentException, model.assert_vm,
                       "valeur_qcq")