Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qatl] api_tprojects, not raise ResponseException when dev_key it's invalid #52

Open
netzulo opened this issue Jul 5, 2018 · 0 comments
Assignees
Labels

Comments

@netzulo
Copy link
Owner

netzulo commented Jul 5, 2018

Description

  • Must return code 200, or another thing? testlink XMLRPC problem
  • Should recognize error structure and raise ResponseException to get working this testcase
    @pytest.skip(True, 'Issue oneped at qatestlink library, #52')
    @pytest.mark.raises(exception=ResponseException)
    def test_raises_tprojects_baddevkey(self):
        """TestCase: test_raises_tprojects_baddevkey"""
        tprojects = self.tlm.api_tprojects(dev_key='willfail')
        if len(tprojects) >= 0:
            raise AssertionError("Not empty Test Projects")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <qatestlink.core.testlink_manager.TLManager object at 0x00000263FF1451D0>
dev_key = 'willfail'

    def api_tprojects(self, dev_key=None):
        """Call to method named 'tl.getProjects' for testlink XMLRPC

            Keyword Arguments:
                dev_key {str} -- string of developer key provided by Testlink
                    (default: {value obtained from JSON settings file})

            Returns:
                list(TProject) -- list of object model for Testlink Test Project
                    data
            """
        if not dev_key:
            dev_key = self._settings.get('dev_key')
        req_data = self._xml_manager.req_tprojects(dev_key)
        res = self._conn.post(self._xml_manager.headers, req_data)
        res_dict = self._xml_manager.parse_response(res)
        res_param = res_dict.get(
            'methodResponse')['params']['param']['value']
        data_list = res_param.get('array')['data']['value']
        tprojects = list()
        for data_properties in data_list:
>           properties = data_properties['struct']['member']
E           TypeError: string indices must be integers

c:\users\cronosadmin\envs\tltests\lib\site-packages\qatestlink-0.0.9-py3.6.egg\qatestlink\core\testlink_manager.py:107: TypeError
-------------------------- Captured stderr teardown ---------------------------
2018-07-05 23:16:51,833 - qatestlink - INFO - POST request:
2018-07-05 23:16:51,833 - qatestlink - DEBUG -     url=http://qalab.tk:86/lib/api/xmlrpc/v1/xmlrpc.php
2018-07-05 23:16:51,833 - qatestlink - DEBUG -     headers={'Content-Type': 'application/xml'}
2018-07-05 23:16:51,833 - qatestlink - DEBUG -     data=b'<?xml version="1.0" encoding="UTF-8" ?><methodCall><methodName>tl.getProjects</methodName><params><struct><name>devKey</name><value>willfail</value></struct></params></methodCall>'
2018-07-05 23:16:51,892 - qatestlink - INFO - POST response:
2018-07-05 23:16:51,892 - qatestlink - INFO -     status_code=200
2018-07-05 23:16:51,892 - qatestlink - DEBUG -     data=<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <array><data>
  <value><struct>
  <member><name>code</name><value><int>2000</int></value></member>
  <member><name>message</name><value><string>Can not authenticate client: invalid developer key</string></value></member>
</struct></value>
</data></array>
      </value>
    </param>
  </params>
</methodResponse>
@netzulo netzulo added the Bug label Jul 5, 2018
@netzulo netzulo self-assigned this Jul 5, 2018
netzulo added a commit that referenced this issue Jul 19, 2018
+ fix for tmp files from py.test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant