Skip to content

Commit

Permalink
[qatl] added method named 'tl.ping'
Browse files Browse the repository at this point in the history
  • Loading branch information
crypto netzulo committed Mar 18, 2018
1 parent bc80753 commit 01e6827
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,9 @@ Usage ( *XMLRPC* )

* **XMLRPC**: *call to method named* '*tl.sayHello*'
* **Description** : get **'Hello!'** message

**api_ping**
+++++++++++++++++++++++

* **XMLRPC**: *call to method named* '*tl.ping*'
* **Description** : get **'Hello!'** message
3 changes: 2 additions & 1 deletion qatestlink/configs/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"build_name_two": "issue2",
"user_name": "qacode",
"about": "Testlink API Version: 1.0 initially written by Asiel Brumfield\n with contributions by TestLink development Team",
"say_hello": "Hello!"
"say_hello": "Hello!",
"ping": "Hello!"
}
}
}
15 changes: 14 additions & 1 deletion qatestlink/core/testlink_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def api_about(self):
return res_value.get('string')

def api_say_hello(self):
"""Call to method named 'tl.about' for testlink XMLRPC
"""Call to method named 'tl.sayHello' for testlink XMLRPC
Returns:
str -- Message predefined by Testlink code
Expand All @@ -474,3 +474,16 @@ def api_say_hello(self):
res_value = res_dict.get(
'methodResponse')['params']['param']['value']
return res_value.get('string')

def api_ping(self):
"""Call to method named 'tl.ping' for testlink XMLRPC
Returns:
str -- Message predefined by Testlink code
"""
req_data = self._xml_manager.req_ping()
res = self._conn.post(self._xml_manager.headers, req_data)
res_dict = self._xml_manager.parse_response(res)
res_value = res_dict.get(
'methodResponse')['params']['param']['value']
return res_value.get('string')
13 changes: 13 additions & 0 deletions qatestlink/core/xmls/xmlrpc_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,3 +677,16 @@ def req_say_hello(self):
xml = dicttoxml(
self.req_dict, custom_root='methodCall', attr_type=False)
return xml

def req_ping(self):
"""String xml object ready to use on API call
Returns:
str -- XML request with parsed params
"""
self.req_dict.update({
"methodName": RouteType.TLINK_PING.value
})
xml = dicttoxml(
self.req_dict, custom_root='methodCall', attr_type=False)
return xml
7 changes: 7 additions & 0 deletions tests/unitaries/suite_002_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ def test_019_method_say_hello(self):
self.assertIsInstance(say_hello, str)
self.assertEquals(say_hello, DATA['say_hello'])

@skipIf(SKIP, SKIP_MESSAGE)
def test_020_method_ping(self):
"""TODO: doc method"""
ping = self.testlink_manager.api_ping()
self.assertIsInstance(ping, str)
self.assertEquals(ping, DATA['ping'])


class TestMethodsRaises(TestCase):
"""Test suite for tests methods
Expand Down

0 comments on commit 01e6827

Please sign in to comment.