diff --git a/zaqarclient/queues/v1/queues.py b/zaqarclient/queues/v1/queues.py index 83563d02..56f5459e 100644 --- a/zaqarclient/queues/v1/queues.py +++ b/zaqarclient/queues/v1/queues.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from zaqarclient._i18n import _ # noqa from zaqarclient import errors from zaqarclient.queues.v1 import claim as claim_api from zaqarclient.queues.v1 import core @@ -25,6 +26,9 @@ class Queue(object): def __init__(self, client, name, auto_create=True): self.client = client + if name == "": + raise ValueError(_('Queue name does not have a value')) + # NOTE(flaper87) Queue Info self._name = name self._metadata = None diff --git a/zaqarclient/tests/queues/queues.py b/zaqarclient/tests/queues/queues.py index 7eec7502..2739ed87 100644 --- a/zaqarclient/tests/queues/queues.py +++ b/zaqarclient/tests/queues/queues.py @@ -66,6 +66,9 @@ class QueuesV1QueueUnitTest(base.QueuesTestBase): # just checking our way down to the transport # doesn't crash. + def test_queue_valid_name(self): + self.assertRaises(ValueError, self.client.queue, "") + def test_queue_delete(self): with mock.patch.object(self.transport, 'send', autospec=True) as send_method: