Move tests: unit/benchmark
[yardstick.git] / yardstick / tests / unit / benchmark / scenarios / lib / test_check_value.py
1 ##############################################################################
2 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
3 #
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 ##############################################################################
9 import unittest
10
11 from yardstick.benchmark.scenarios.lib.check_value import CheckValue
12
13 class CheckValueTestCase(unittest.TestCase):
14
15     def setUp(self):
16         self.result = {}
17
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)
23
24     def test_check_value_eq_pass(self):
25         scenario_cfg = {'options': {'operator': 'eq', 'value1': 1, 'value2': 1}}
26         obj = CheckValue(scenario_cfg, {})
27
28         obj.run(self.result)
29         self.assertEqual({}, self.result)
30
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)
36
37 def main():
38     unittest.main()
39
40
41 if __name__ == '__main__':
42     main()