1 ##############################################################################
2 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 from yardstick.benchmark.scenarios.lib import check_value
12 from yardstick.common import exceptions as y_exc
15 class CheckValueTestCase(unittest.TestCase):
17 def test_eq_pass(self):
18 scenario_cfg = {'options': {'operator': 'eq',
21 obj = check_value.CheckValue(scenario_cfg, {})
24 self.assertEqual({}, result)
26 def test_ne_pass(self):
27 scenario_cfg = {'options': {'operator': 'ne',
30 obj = check_value.CheckValue(scenario_cfg, {})
33 self.assertEqual({}, result)
35 def test_result(self):
36 scenario_cfg = {'options': {'operator': 'eq',
40 obj = check_value.CheckValue(scenario_cfg, {})
43 self.assertDictEqual(result, {'foo': 'PASS'})
46 scenario_cfg = {'options': {'operator': 'eq',
49 obj = check_value.CheckValue(scenario_cfg, {})
51 with self.assertRaises(y_exc.ValueCheckError):
53 self.assertEqual({}, result)
56 scenario_cfg = {'options': {'operator': 'ne',
59 obj = check_value.CheckValue(scenario_cfg, {})
61 with self.assertRaises(y_exc.ValueCheckError):
63 self.assertEqual({}, result)