Skip to content

Commit

Permalink
[qatl] added method named 'tl.about' (#39)
Browse files Browse the repository at this point in the history
* [qatl] added method named 'tl.about'

* [qatl] flake8 fixes
  • Loading branch information
netzulo committed Mar 18, 2018
1 parent 1590ba2 commit 47f51c6
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 @@ -242,3 +242,9 @@ Usage ( *XMLRPC* )

* **XMLRPC**: *call to method named* '*tl.doesUserExist*'
* **Description** : check if user name it's valid

**api_about**
+++++++++++++++++++++++

* **XMLRPC**: *call to method named* '*tl.about*'
* **Description** : get default message with author and testlink version
3 changes: 2 additions & 1 deletion qatestlink/configs/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"build_name_one": "issue1",
"build_id_two": 2,
"build_name_two": "issue2",
"user_name": "qacode"
"user_name": "qacode",
"about": "Testlink API Version: 1.0 initially written by Asiel Brumfield\n with contributions by TestLink development Team"
}
}
}
13 changes: 13 additions & 0 deletions qatestlink/core/testlink_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,16 @@ def api_user_exist(self, user_name, dev_key=None):
if res_value.get('boolean'):
return bool(res_value.get('boolean'))
self._xml_manager.parse_errors(res_dict)

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

def req_about(self):
"""String xml object ready to use on API call
Returns:
str -- XML request with parsed params
"""
self.req_dict.update({
"methodName": RouteType.TLINK_ABOUT.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 @@ -209,6 +209,13 @@ def test_017_method_user_exist(self):
DATA['user_name'])
self.assertTrue(is_user)

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


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

0 comments on commit 47f51c6

Please sign in to comment.