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

initial routing api support #474

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

jtanner-testbox
Copy link

No description provided.

@jtanner-testbox jtanner-testbox marked this pull request as draft March 26, 2021 17:54
@jtanner-testbox
Copy link
Author

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?

@facetoe
Copy link
Owner

facetoe commented Apr 2, 2021

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.

@cryptomail
Copy link
Collaborator

👻

@cryptomail
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants