small bug with account to account copy

Change-Id: I7fdf432666f7640082e9839b9dc3d7af94a0715f
This commit is contained in:
David Goetz 2015-02-11 11:37:31 -08:00
parent 843ce7e301
commit 69797efcbb
2 changed files with 10 additions and 0 deletions

View File

@ -388,6 +388,10 @@ def check_account_format(req, account):
:raise: HTTPPreconditionFailed if account header
is not well formatted.
"""
if not account:
raise HTTPPreconditionFailed(
request=req,
body='Account name cannot be empty')
if isinstance(account, unicode):
account = account.encode('utf-8')
if '/' in account:

View File

@ -502,6 +502,12 @@ class TestConstraints(unittest.TestCase):
self.assertRaises(HTTPException,
constraints.check_account_format,
req, req.headers['X-Copy-From-Account'])
req = Request.blank(
'/v/a/c/o',
headers={'X-Copy-From-Account': ''})
self.assertRaises(HTTPException,
constraints.check_account_format,
req, req.headers['X-Copy-From-Account'])
class TestConstraintsConfig(unittest.TestCase):