Add missing tests for db.block_device_mapping_* methods

There was no tests in test_db_api for block_device_mapping_* methods.
Add tests to ensure that all works. Also these tests allow us to refactor
work with session in these methods.

Fix bug in is_ephemeral we should return True or False not instance of
_sre.SRE_Match or None.

blueprint db-api-tests

Change-Id: I3cac17e7d2c8d0b2608fb9a78ea29210f025222b
This commit is contained in:
Boris Pavlovic
2013-03-12 11:05:30 +04:00
parent ae251b99a3
commit 27b4c62b69
2 changed files with 148 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ _ephemeral = re.compile('^ephemeral(\d|[1-9]\d+)$')
def is_ephemeral(device_name):
return _ephemeral.match(device_name)
return _ephemeral.match(device_name) is not None
def ephemeral_num(ephemeral_name):