Improve storage unit test coverage

- Minor cleanup to tests.
- Use assertRaisesRegex for exception testing.

Change-Id: I519d9e648e684238ca19d00df6abf9b472e3c666
This commit is contained in:
Erik Olof Gunnar Andersson
2023-05-28 20:16:51 -07:00
parent 9ba81579ac
commit a7cbcc0770
2 changed files with 977 additions and 334 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,36 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
import oslotest.base
from designate.storage import sqlalchemy
CONF = cfg.CONF
class SqlalchemyTestCase(oslotest.base.BaseTestCase):
def setUp(self):
super(SqlalchemyTestCase, self).setUp()
self.storage = sqlalchemy.SQLAlchemyStorage()
def test_rname_check(self):
self.assertEqual(
{'name': 'foo'}, self.storage._rname_check({'name': 'foo'})
)
def test_rname_check_reverse_name(self):
self.assertEqual(
{'reverse_name': 'oof*'},
self.storage._rname_check({'name': '*foo'})
)