Fix issues in Mistral code

Change-Id: Ideb3fcaaa5b07926a0d30cf84590819896088a6b
This commit is contained in:
Anastasia Kuznetsova 2015-02-09 18:22:46 +04:00
parent 4bb12807c9
commit 4945d86ab5
2 changed files with 6 additions and 11 deletions

View File

@ -18,15 +18,11 @@ import mock
from rally.benchmark.scenarios.mistral import utils
from tests.unit import test
BM_UTILS = "rally.benchmark.utils"
MISTRAL_UTILS = "rally.benchmark.scenarios.mistral.utils"
class MistralScenarioTestCase(test.TestCase):
def setUp(self):
super(MistralScenarioTestCase, self).setUp()
def _test_atomic_action_timer(self, atomic_actions, name):
action_duration = atomic_actions.get(name)
self.assertIsNotNone(action_duration)

View File

@ -255,22 +255,21 @@ class PreprocessTestCase(test.TestCase):
class FileTypeTestCase(test.TestCase):
def setUp(self):
super(FileTypeTestCase, self).setUp()
self.clients = fakes.FakeClients()
@mock.patch("rally.benchmark.types.open",
side_effect=mock.mock_open(read_data="file_context"),
create=True)
def test_transform_by_path(self, mock_open):
resource_config = "file.yaml"
file_context = types.FileType.transform(
clients=self.clients,
clients=None,
resource_config=resource_config)
self.assertEqual(file_context, "file_context")
def test_transform_by_path_no_match(self):
@mock.patch("rally.benchmark.types.open",
side_effect=IOError, create=True)
def test_transform_by_path_no_match(self, mock_open):
resource_config = "nonexistant.yaml"
self.assertRaises(IOError,
types.FileType.transform,
self.clients, resource_config)
clients=None,
resource_config=resource_config)