Merge "Test Case: OPNFV_YARDSTICK_TC023: VM availability during live migration"
[yardstick.git] / 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
14 class CheckValueTestCase(unittest.TestCase):
15
16     def test_check_value_eq(self):
17         scenario_cfg = {'options': {'operator': 'eq', 'value1': 1, 'value2': 2}}
18         obj = CheckValue(scenario_cfg, {})
19         try:
20             obj.run({})
21         except Exception as e:
22             self.assertIsInstance(e, AssertionError)
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         try:
28             obj.run({})
29         except Exception as e:
30             self.assertIsInstance(e, AssertionError)
31
32     def test_check_value_ne(self):
33         scenario_cfg = {'options': {'operator': 'ne', 'value1': 1, 'value2': 1}}
34         obj = CheckValue(scenario_cfg, {})
35         try:
36             obj.run({})
37         except Exception as e:
38             self.assertIsInstance(e, AssertionError)
39
40
41 def main():
42     unittest.main()
43
44
45 if __name__ == '__main__':
46     main()