Add tests for mutually exclusive [min|max]version

As suggested by Lance [1], add test cases to prove that configuring
`version` is mutually exclusive with configuring *either* `min_version`
or `max_version`.

[1] https://review.openstack.org/#/c/482742/7/keystoneauth1/tests/unit/loading/test_adapter.py@76

Change-Id: I4fea4d149feccebcbb29c34dc2bd4de5669aa1f4
This commit is contained in:
Eric Fried 2017-09-01 16:31:35 -05:00
parent 4b15f5706a
commit 70e1f44169
1 changed files with 25 additions and 1 deletions

View File

@ -117,7 +117,31 @@ class ConfLoadingTests(utils.TestCase):
self.assertEqual('2.0', adap.min_version)
self.assertEqual('3.0', adap.max_version)
def test_load_bad_version(self):
def test_version_mutex_min(self):
self.conf_fx.config(
service_type='type', service_name='name',
valid_interfaces='iface',
region_name='region', endpoint_override='endpoint',
version='2.0', min_version='2.0', group=self.GROUP)
self.assertRaises(
TypeError,
loading.load_adapter_from_conf_options,
self.conf_fx.conf, self.GROUP, session='session', auth='auth')
def test_version_mutex_max(self):
self.conf_fx.config(
service_type='type', service_name='name',
valid_interfaces='iface',
region_name='region', endpoint_override='endpoint',
version='2.0', max_version='3.0', group=self.GROUP)
self.assertRaises(
TypeError,
loading.load_adapter_from_conf_options,
self.conf_fx.conf, self.GROUP, session='session', auth='auth')
def test_version_mutex_minmax(self):
self.conf_fx.config(
service_type='type', service_name='name',
valid_interfaces='iface',