|
| 1 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | +# not use this file except in compliance with the License. You may obtain |
| 3 | +# a copy of the License at |
| 4 | +# |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | +# License for the specific language governing permissions and limitations |
| 11 | +# under the License. |
| 12 | + |
| 13 | +from openstack.tests.unit import base |
| 14 | +from otcextensions.sdk.apig.v2 import config |
| 15 | + |
| 16 | +EXAMPLE_CONFIG = { |
| 17 | + 'config_id': 'conf-123', |
| 18 | + 'config_name': 'flow_control', |
| 19 | + 'config_value': '1000', |
| 20 | + 'config_time': '2025-01-01T12:00:00Z', |
| 21 | + 'remark': 'Maximum requests per second', |
| 22 | + 'used': '350' |
| 23 | +} |
| 24 | + |
| 25 | + |
| 26 | +class TestConfig(base.TestCase): |
| 27 | + |
| 28 | + def test_basic(self): |
| 29 | + sot = config.Config() |
| 30 | + self.assertEqual('/apigw/instance/configs', sot.base_path) |
| 31 | + self.assertTrue(sot.allow_list) |
| 32 | + self.assertEqual('configs', sot.resources_key) |
| 33 | + |
| 34 | + def test_make_it(self): |
| 35 | + sot = config.Config(**EXAMPLE_CONFIG) |
| 36 | + self.assertEqual('conf-123', sot.config_id) |
| 37 | + self.assertEqual('flow_control', sot.config_name) |
| 38 | + self.assertEqual('1000', sot.config_value) |
| 39 | + self.assertEqual('2025-01-01T12:00:00Z', sot.config_time) |
| 40 | + self.assertEqual('Maximum requests per second', sot.remark) |
| 41 | + self.assertEqual('350', sot.used) |
0 commit comments