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.check_value import CheckValue
13 class CheckValueTestCase(unittest.TestCase):
18 def test_check_value_eq(self):
19 scenario_cfg = {'options': {'operator': 'eq', 'value1': 1, 'value2': 2}}
20 obj = CheckValue(scenario_cfg, {})
21 self.assertRaises(AssertionError, obj.run, self.result)
22 self.assertEqual({}, self.result)
24 def test_check_value_eq_pass(self):
25 scenario_cfg = {'options': {'operator': 'eq', 'value1': 1, 'value2': 1}}
26 obj = CheckValue(scenario_cfg, {})
29 self.assertEqual({}, self.result)
31 def test_check_value_ne(self):
32 scenario_cfg = {'options': {'operator': 'ne', 'value1': 1, 'value2': 1}}
33 obj = CheckValue(scenario_cfg, {})
34 self.assertRaises(AssertionError, obj.run, self.result)
35 self.assertEqual({}, self.result)