zenpy icon indicating copy to clipboard operation
zenpy copied to clipboard

initial routing api support

Open jtanner-testbox opened this issue 5 years ago • 4 comments

jtanner-testbox avatar Mar 26 '21 17:03 jtanner-testbox

I've noted that running units locally tries to connect to a remote zendesk instance ...

======================================================================
ERROR: test_single_object_creation (test_api.test_routing_api.TestRoutingApi)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jtanner/workspace/github/TestBoxLab/zenpy.fork/tests/test_api/fixtures/__init__.py", line 303, in test_single_object_creation
    self.create_and_verify_single_object_creation()
  File "/home/jtanner/workspace/github/TestBoxLab/zenpy.fork/tests/test_api/fixtures/__init__.py", line 316, in create_and_verify_single_object_creation
    zenpy_object = self.create_single_zenpy_object()
  File "/home/jtanner/workspace/github/TestBoxLab/zenpy.fork/tests/test_api/fixtures/__init__.py", line 178, in create_single_zenpy_object
    return self.create_method(zenpy_object)
  File "/home/jtanner/workspace/github/TestBoxLab/zenpy.fork/zenpy/lib/api.py", line 528, in create
    return CRUDRequest(self).post(api_objects, **kwargs)
  File "/home/jtanner/workspace/github/TestBoxLab/zenpy.fork/zenpy/lib/request.py", line 81, in post
    return self.api._post(url, payload)
  File "/home/jtanner/workspace/github/TestBoxLab/zenpy.fork/zenpy/lib/api.py", line 83, in _post
    response = self._call_api(self.session.post,
  File "/home/jtanner/workspace/github/TestBoxLab/zenpy.fork/zenpy/lib/api.py", line 156, in _call_api
    self._check_response(response)
  File "/home/jtanner/workspace/github/TestBoxLab/zenpy.fork/zenpy/lib/api.py", line 319, in _check_response
    raise APIException(json.dumps(_json), response=response)
zenpy.lib.exception.APIException: {"error": "Couldn't authenticate you"}
-------------------- >> begin captured logging << --------------------
zenpy.lib.api: DEBUG: Setting dirty object: RoutingAttribute(id=None)
zenpy.lib.api: DEBUG: POST: https://d3v-zenpydev.zendesk.com/api/v2/routing/attributes.json - {'json': {'attribute': {'id': None, 'name': 'test_attribute'}}, 'timeout': 60.0, 'headers': None}
zenpy.lib.api: DEBUG: Received response code [401] - headers: {'CF-Cache-Status': 'DYNAMIC', 'CF-RAY': '6362035fec14c175-IAD', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive', 'Content-Length': '37', 'Content-Type': 'application/json; charset=UTF-8', 'Date': 'Fri, 26 Mar 2021 17:14:04 GMT', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'NEL': '{"report_to":"cf-nel","max_age":604800}', 'Report-To': '{"max_age":604800,"group":"cf-nel","endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report?s=ewM33XREM5HSt22f2abWdOFIeaygpJrMIfIbhN%2F6qefSt4FA9LJcNK%2BtRuKkFRxrI7J28OS5x%2FLqi8o6FOwcFYqrPFaCpNrV5vdWr0Rl9Vcxzdtg8oo%2BjXg%3D"}]}', 'Server': 'cloudflare', 'Set-Cookie': '__cfduid=da0492391486385d6835ff680e0bea74a1616778844; expires=Sun, 25-Apr-21 17:14:04 GMT; path=/; domain=.d3v-zenpydev.zendesk.com; HttpOnly; SameSite=Lax, __cfruid=0bf752e1b168cf8823707bb71dfeca1d3eb337bb-1616778844; path=/; domain=.d3v-zenpydev.zendesk.com; HttpOnly; Secure; SameSite=None', 'Strict-Transport-Security': 'max-age=31536000;', 'WWW-Authenticate': 'Basic realm="Web Password"', 'X-Request-Id': '6362035fec14c175-SEA, 6362035fec14c175-SEA', 'X-Runtime': '0.132223', 'X-Zendesk-Origin-Server': 'classic-app-server-74768fc5df-ppx8z', 'X-Zendesk-Zorg': 'yes', 'cf-request-id': '0911206ff40000c175b824c000000001'}

Is CI setup to provide secrets somehow, or is the remote url+creds overridable so I can run tests myself against my own instances?

jtanner-testbox avatar Mar 26 '21 17:03 jtanner-testbox

Ahh yes, there is a nasty hack that allows it to work locally - https://github.com/facetoe/zenpy/blob/master/tests/test_api/init.py#L12. If you create that file you should be able to run the tests locally against your own instance.

facetoe avatar Apr 02 '21 09:04 facetoe

👻

cryptomail avatar Sep 17 '23 16:09 cryptomail

Wondering if we should have a look at this instead of letting it lie fallow 🍇

cryptomail avatar Sep 17 '23 16:09 cryptomail