Commit 1f756c05 authored by aikchar's avatar aikchar

Add request to purge queue

parent 1bb033d0
......@@ -174,3 +174,19 @@ class RequestCmd:
logger.debug("Message content -> {0}".format(content))
return content, self.query_properties
def purge_queue(self, name):
"""Create message content and properties to purge queue with QMFv2
:param name: Name of queue to purge
:type name: str
:returns: Tuple containing content and method properties
"""
content = {"_object_id": {"_object_name": self.object_name},
"_method_name": "purge",
"_arguments": {"type": "queue",
"name": name}}
logger.debug("Message content -> {0}".format(content))
return content, self.method_properties
......@@ -72,3 +72,24 @@ class TestRequestQueue:
assert content == expected_content
assert properties == expected_properties
@pytest.mark.list
def test_purge_queue_myqueue(self):
req = RequestCmd()
queue = "myqueue"
content, properties = req.purge_queue(queue)
logger.debug("Content -> {0}".format(content))
logger.debug("Properties -> {0}".format(properties))
expected_content = {"_object_id": {"_object_name": "org.apache.qpid.broker:broker:amqp-broker"},
"_method_name": "purge",
"_arguments": {"type": "queue",
"name": queue}}
logger.debug("Expected content -> {0}".format(expected_content))
expected_properties = {"x-amqp-0-10.app-id": "qmf2", "qmf.opcode": "_method_request", "method": "request"}
logger.debug("Expected properties -> {0}".format(expected_properties))
assert content == expected_content
assert properties == expected_properties
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment