mirror of
https://github.com/socialwifi/RouterOS-api.git
synced 2025-08-30 14:49:55 +02:00
Merge pull request #103 from quentinmit/ros718-empty
Add support for RouterOS 7.18's `!empty` reply word
This commit is contained in:
commit
d05c0b13ef
2 changed files with 9 additions and 1 deletions
|
@ -3,7 +3,7 @@ import re
|
||||||
from routeros_api import exceptions
|
from routeros_api import exceptions
|
||||||
from routeros_api import query
|
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)
|
attribute_re = re.compile(rb'^=([^=]+)=(.*)$', re.DOTALL)
|
||||||
tag_re = re.compile(rb'^\.tag=(.*)$')
|
tag_re = re.compile(rb'^\.tag=(.*)$')
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,14 @@ class TestCommunicator(TestCase):
|
||||||
self.assertRaises(exceptions.RouterOsApiCommunicationError,
|
self.assertRaises(exceptions.RouterOsApiCommunicationError,
|
||||||
promise.get)
|
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):
|
def test_query_call(self):
|
||||||
base = mock.Mock()
|
base = mock.Mock()
|
||||||
base.receive_sentence.return_value = [b'!done', b'.tag=1']
|
base.receive_sentence.return_value = [b'!done', b'.tag=1']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue