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): if not check_utf8(value):
raise HTTPBadRequest('Metadata must be valid UTF-8') raise HTTPBadRequest('Metadata must be valid UTF-8')
key = key.lower() key = key.lower()
if len(value) != 0 and (key.startswith('x-account-meta') or if value and key.startswith(('x-account-meta-',
key.startswith('x-container-meta')): 'x-container-meta-')):
prefix = 'x-account-meta-' prefix = 'x-account-meta-'
if key.startswith('x-container-meta-'): if key.startswith('x-container-meta-'):
prefix = 'x-container-meta-' prefix = 'x-container-meta-'

View File

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