DB follow-up

Change-Id: I32cff110f0771d6d92a881ef52e482aa17d8dbe4
Related-Change: I0dab4ff013f300396cff7313bc27b9d5644fe8a7
This commit is contained in:
Tim Burke 2018-10-05 21:42:46 +00:00
parent e3a5b63cc7
commit 6e7ca26169
2 changed files with 4 additions and 6 deletions

View File

@ -884,8 +884,8 @@ class DatabaseBroker(object):
if not check_utf8(value):
raise HTTPBadRequest('Metadata must be valid UTF-8')
key = key.lower()
if len(value) != 0 and (key.startswith('x-account-meta') or
key.startswith('x-container-meta')):
if value and key.startswith(('x-account-meta-',
'x-container-meta-')):
prefix = 'x-account-meta-'
if key.startswith('x-container-meta-'):
prefix = 'x-container-meta-'

View File

@ -687,11 +687,9 @@ class TestDatabaseBroker(unittest.TestCase):
stub_dict = {}
def stub(*args, **kwargs):
for key in list(stub_dict.keys()):
del stub_dict[key]
stub_dict.clear()
stub_dict['args'] = args
for key, value in kwargs.items():
stub_dict[key] = value
stub_dict.update(kwargs)
broker = DatabaseBroker(':memory:')
broker._initialize = stub
broker.initialize(normalize_timestamp('1'))