Пример #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)
Пример #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)
Пример #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")
Пример #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")
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #15
0
 def test_assert_vm_raise(self):
     model = ModelRoot()
     self.assertRaises(IllegalArgumentException, model.assert_vm,
                       "valeur_qcq")