Merge "Raises an error if the queue name is empty"

This commit is contained in:
Jenkins 2015-07-06 21:14:04 +00:00 committed by Gerrit Code Review
commit 6c615fdb43
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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: