Skip to content

Commit

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

* **XMLRPC**: *call to method named* '*tl.about*'
* **Description** : get default message with author and testlink version

**api_say_hello**
+++++++++++++++++++++++

* **XMLRPC**: *call to method named* '*tl.sayHello*'
* **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 @@ -27,7 +27,8 @@
"build_id_two": 2,
"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"
"about": "Testlink API Version: 1.0 initially written by Asiel Brumfield\n with contributions by TestLink development Team",
"say_hello": "Hello!"
}
}
}
13 changes: 13 additions & 0 deletions qatestlink/core/testlink_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,16 @@ def api_about(self):
res_value = res_dict.get(
'methodResponse')['params']['param']['value']
return res_value.get('string')

def api_say_hello(self):
"""Call to method named 'tl.about' for testlink XMLRPC
Returns:
str -- Message predefined by Testlink code
"""
req_data = self._xml_manager.req_say_hello()
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 @@ -664,3 +664,16 @@ def req_about(self):
xml = dicttoxml(
self.req_dict, custom_root='methodCall', attr_type=False)
return xml

def req_say_hello(self):
"""String xml object ready to use on API call
Returns:
str -- XML request with parsed params
"""
self.req_dict.update({
"methodName": RouteType.TLINK_SAY_HELLO.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 @@ -216,6 +216,13 @@ def test_018_method_about(self):
self.assertIsInstance(about, str)
self.assertEquals(about, DATA['about'])

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


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

0 comments on commit f51deb6

Please sign in to comment.