Scott Baker | 9674688 | 2017-06-09 14:12:15 -0700 | [diff] [blame] | 1 | import unittest |
| 2 | from mock import patch |
| 3 | import mock |
| 4 | |
| 5 | import os, sys |
| 6 | sys.path.append("../../..") |
| 7 | sys.path.append("../../new_base/model_policies") |
| 8 | config = basic_conf = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/test_config.yaml") |
| 9 | from xosconfig import Config |
| 10 | Config.init(config, 'synchronizer-config-schema.yaml') |
| 11 | |
| 12 | import synchronizers.new_base.modelaccessor |
| 13 | |
| 14 | from model_policy_vsgtenant import VSGTenantPolicy |
| 15 | |
| 16 | class MockVSGTenant: |
| 17 | provider_service = None |
| 18 | deleted = False |
| 19 | instance = None |
| 20 | volt = None |
| 21 | |
| 22 | class TestModelPolicyVsgTenant(unittest.TestCase): |
| 23 | def setUp(self): |
| 24 | self.policy = VSGTenantPolicy() |
| 25 | self.tenant = MockVSGTenant() |
| 26 | |
| 27 | def test_manage_container_no_volt(self): |
| 28 | with self.assertRaises(Exception) as e: |
| 29 | self.policy.manage_container(self.tenant) |
| 30 | self.assertEqual(e.exception.message, "This VSG container has no volt") |
| 31 | |
| 32 | if __name__ == '__main__': |
| 33 | unittest.main() |
| 34 | |