mirror of
https://github.com/socialwifi/RouterOS-api.git
synced 2025-08-30 14:49:55 +02:00
Add support for RouterOS 7.18's !empty
reply word
See documentation at https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API#API-Replyword
This commit is contained in:
parent
5e7963fcfe
commit
68aaa5ace9
2 changed files with 9 additions and 1 deletions
|
@ -3,7 +3,7 @@ import re
|
|||
from routeros_api import exceptions
|
||||
from routeros_api import query
|
||||
|
||||
response_re = re.compile(rb'^!(re|trap|fatal|done)$')
|
||||
response_re = re.compile(rb'^!(re|trap|fatal|empty|done)$')
|
||||
attribute_re = re.compile(rb'^=([^=]+)=(.*)$', re.DOTALL)
|
||||
tag_re = re.compile(rb'^\.tag=(.*)$')
|
||||
|
||||
|
|
|
@ -49,6 +49,14 @@ class TestCommunicator(TestCase):
|
|||
self.assertRaises(exceptions.RouterOsApiCommunicationError,
|
||||
promise.get)
|
||||
|
||||
def test_empty_call(self):
|
||||
base = mock.Mock()
|
||||
base.receive_sentence.side_effect = [[b'!empty', b'.tag=1'],
|
||||
[b'!done', b'.tag=1']]
|
||||
communicator = api_communicator.ApiCommunicator(base)
|
||||
response = communicator.call('/file/', 'print').get()
|
||||
self.assertEqual(response, [])
|
||||
|
||||
def test_query_call(self):
|
||||
base = mock.Mock()
|
||||
base.receive_sentence.return_value = [b'!done', b'.tag=1']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue