コード例 #1
0
ファイル: test_model.py プロジェクト: icclab/watcher
 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
ファイル: test_model.py プロジェクト: XroLLla/watcher
 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
ファイル: test_model.py プロジェクト: XroLLla/watcher
 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
ファイル: test_model.py プロジェクト: icclab/watcher
 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
ファイル: test_model.py プロジェクト: XroLLla/watcher
    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
ファイル: test_model.py プロジェクト: icclab/watcher
    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
ファイル: test_model.py プロジェクト: XroLLla/watcher
    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
ファイル: test_model.py プロジェクト: icclab/watcher
    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
ファイル: test_model.py プロジェクト: XroLLla/watcher
    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
ファイル: test_model.py プロジェクト: icclab/watcher
    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
ファイル: test_model.py プロジェクト: icclab/watcher
 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
ファイル: test_model.py プロジェクト: icclab/watcher
 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
ファイル: test_model.py プロジェクト: XroLLla/watcher
 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
ファイル: test_model.py プロジェクト: XroLLla/watcher
 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
ファイル: test_model.py プロジェクト: icclab/watcher
 def test_assert_vm_raise(self):
     model = ModelRoot()
     self.assertRaises(IllegalArgumentException, model.assert_vm,
                       "valeur_qcq")