Esempio n. 1
0
    def test_allowed_keys_are_real(self):
        instance = models.Instance()
        keys = list(conductor_manager.allowed_updates)

        # NOTE(danms): expected_task_state is a parameter that gets
        # passed to the db layer, but is not actually an instance attribute
        del keys[keys.index('expected_task_state')]

        for key in keys:
            self.assertTrue(hasattr(instance, key))
Esempio n. 2
0
 def _get_dummy_instance(self):
     """Get mock-return-value instance object
        Use this when any testcase executed later than test_run_terminate
     """
     vol1 = models.Volume()
     vol1['id'] = 1
     vol2 = models.Volume()
     vol2['id'] = 2
     instance_ref = models.Instance()
     instance_ref['id'] = 1
     instance_ref['volumes'] = [vol1, vol2]
     instance_ref['hostname'] = 'hostname-1'
     instance_ref['host'] = 'dummy'
     return instance_ref