small bug with account to account copy
Change-Id: I7fdf432666f7640082e9839b9dc3d7af94a0715f
This commit is contained in:
parent
843ce7e301
commit
69797efcbb
@ -388,6 +388,10 @@ def check_account_format(req, account):
|
|||||||
:raise: HTTPPreconditionFailed if account header
|
:raise: HTTPPreconditionFailed if account header
|
||||||
is not well formatted.
|
is not well formatted.
|
||||||
"""
|
"""
|
||||||
|
if not account:
|
||||||
|
raise HTTPPreconditionFailed(
|
||||||
|
request=req,
|
||||||
|
body='Account name cannot be empty')
|
||||||
if isinstance(account, unicode):
|
if isinstance(account, unicode):
|
||||||
account = account.encode('utf-8')
|
account = account.encode('utf-8')
|
||||||
if '/' in account:
|
if '/' in account:
|
||||||
|
@ -502,6 +502,12 @@ class TestConstraints(unittest.TestCase):
|
|||||||
self.assertRaises(HTTPException,
|
self.assertRaises(HTTPException,
|
||||||
constraints.check_account_format,
|
constraints.check_account_format,
|
||||||
req, req.headers['X-Copy-From-Account'])
|
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):
|
class TestConstraintsConfig(unittest.TestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user