Skip to content

Commit

Permalink
audits_cbp (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptomail authored Sep 1, 2023
1 parent 79a60d4 commit 67562c6
Show file tree
Hide file tree
Showing 196 changed files with 26,391 additions and 28,001 deletions.
34 changes: 16 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@ run_tests: &run_tests
version: 2
jobs:
python2.7:
docker:
- image: cimg/python:2.7
working_director: ~/repo
steps:
- run:
name: install virtualenv
command: pip install virtualenv
- checkout
- run:
name: install zenpy
command: |
python -m virtualenv venv
. venv/bin/activate
pip install -r requirements.dev
make pytest
python3.5:
docker:
- image: cimg/python:3.5
Expand Down Expand Up @@ -60,14 +44,28 @@ jobs:
steps:
- checkout
- <<: *run_tests

python3.10:
docker:
- image: cimg/python:3.10
working_director: ~/repo
steps:
- checkout
- <<: *run_tests
python3.11:
docker:
- image: cimg/python:3.11
working_director: ~/repo
steps:
- checkout
- <<: *run_tests
workflows:
version: 2
build_and_test:
jobs:
- python2.7
- python3.5
- python3.6
- python3.7
- python3.8
- python3.9
- python3.10
- python3.11
5 changes: 3 additions & 2 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ or
To test on a live account you need to carry out the steps below:

1. Put **zenpy-test-credentials.json** to a home directory (~).
2. Delete all files in **./tests/test_api/betamax/**.
2. Delete all files in **./tests/test_api/betamax/**. (```scripts/clean_betamax.sh```)
3. Then start testing as usual.
4. If a test fails, delete its files in betamax before restarting.

Expand All @@ -57,7 +57,8 @@ To pass all the tests successfully, please provide some things:
1. In **./zenpy/cache.py:ZenpyCacheManager.__init__** temporary change ttl for ticket cache to 300. Some tests take too much time and fail on expired cache elements.
2. In **./zenpy/tests/test_api/test_incremental_object_update.py:TestIncrementalObjectUpdate.setUp** provide an existing ticket id.
3. In **./zenpy/tests/test_api/test_webhooks_api.py:TestWebhooks.test_invocations** and **.test_invocation_attempts** put a real webhook id with a non-empty list of invocations.
4. Please do not commit these changes to the main repository.
5. In the scripts folder, you can remove all betamax outputs with ```clean_betamax.sh```
7. Look for all TESTING_CHANGE in the source and REVERT ones that say it's NOT OK TO COMMIT.

Notes:

Expand Down
2 changes: 2 additions & 0 deletions scripts/clean_betamax.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
\rm ../tests/test_api/betamax/*.json
8 changes: 4 additions & 4 deletions tests/test_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ def configure():
config.default_cassette_options["record_mode"] = "once"
config.default_cassette_options["match_requests_on"] = ["method", "path_matcher"]
if credentials:
auth_key = "token" if "token" in credentials else "password"
auth_key, template = ("token", "{}/token:{}") if "token" in credentials else ("password", "{}:{}")
config.define_cassette_placeholder(
"<ZENPY-CREDENTIALS>",
base64.b64encode(
"{}/token:{}".format(
template.format(
credentials["email"], credentials[auth_key]
).encode("utf-8")
).decode('utf-8'),
)
if credentials["subdomain"] != "d3v-zenpydev":
config.define_cassette_placeholder(
"https://d3v-zenpydev.zendesk.com",
"https://{}.zendesk.com".format(credentials["subdomain"])
"d3v-zenpydev.zendesk.com",
"{}.zendesk.com".format(credentials["subdomain"])
)

session = requests.Session()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api/betamax/TestActivities.test_pagination.json
Original file line number Diff line number Diff line change
Expand Up @@ -850,4 +850,4 @@
}
],
"recorded_with": "betamax/0.8.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"http_interactions": [
{
"recorded_at": "2023-08-16T14:54:31",
"recorded_at": "2023-08-31T18:45:05",
"request": {
"body": {
"encoding": "utf-8",
Expand All @@ -27,7 +27,7 @@
"application/octet-stream"
],
"User-Agent": [
"Zenpy/2.0.27"
"Zenpy/2.0.34"
]
},
"method": "POST",
Expand All @@ -36,32 +36,32 @@
"response": {
"body": {
"encoding": "utf-8",
"string": "{\"upload\":{\"token\":\"y6SDuAiKf05CjciJkmtm5ADQH\",\"expires_at\":\"2023-08-19T14:54:31Z\",\"attachments\":[{\"url\":\"https://d3v-zenpydev.zendesk.com/api/v2/attachments/13120610139410.json\",\"id\":13120610139410,\"file_name\":\"fancybytes.txt\",\"content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/viiOwKJTThOypLSXv0ZEsby3V/?name=fancybytes.txt\",\"mapped_content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/viiOwKJTThOypLSXv0ZEsby3V/?name=fancybytes.txt\",\"content_type\":\"text/plain\",\"size\":1048576,\"width\":null,\"height\":null,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[]}],\"attachment\":{\"url\":\"https://d3v-zenpydev.zendesk.com/api/v2/attachments/13120610139410.json\",\"id\":13120610139410,\"file_name\":\"fancybytes.txt\",\"content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/viiOwKJTThOypLSXv0ZEsby3V/?name=fancybytes.txt\",\"mapped_content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/viiOwKJTThOypLSXv0ZEsby3V/?name=fancybytes.txt\",\"content_type\":\"text/plain\",\"size\":1048576,\"width\":null,\"height\":null,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[]}}}"
"string": "{\"upload\":{\"token\":\"B5davkP0u4rjz76T6cXXrhJ1S\",\"expires_at\":\"2023-09-03T18:45:05Z\",\"attachments\":[{\"url\":\"https://d3v-zenpydev.zendesk.com/api/v2/attachments/6097502017050.json\",\"id\":6097502017050,\"file_name\":\"fancybytes.txt\",\"content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/xyzrGT2dWMq7c76AceSNN4OYj/?name=fancybytes.txt\",\"mapped_content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/xyzrGT2dWMq7c76AceSNN4OYj/?name=fancybytes.txt\",\"content_type\":\"text/plain\",\"size\":1048576,\"width\":null,\"height\":null,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[]}],\"attachment\":{\"url\":\"https://d3v-zenpydev.zendesk.com/api/v2/attachments/6097502017050.json\",\"id\":6097502017050,\"file_name\":\"fancybytes.txt\",\"content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/xyzrGT2dWMq7c76AceSNN4OYj/?name=fancybytes.txt\",\"mapped_content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/xyzrGT2dWMq7c76AceSNN4OYj/?name=fancybytes.txt\",\"content_type\":\"text/plain\",\"size\":1048576,\"width\":null,\"height\":null,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[]}}}"
},
"headers": {
"CF-Cache-Status": [
"DYNAMIC"
],
"CF-RAY": [
"7f7a8350dc202e01-ARN"
"7ff76dafbfefeb4b-SEA"
],
"Connection": [
"keep-alive"
],
"Content-Length": [
"1197"
"1235"
],
"Content-Type": [
"text/plain; charset=utf-8"
],
"Date": [
"Wed, 16 Aug 2023 14:54:31 GMT"
"Thu, 31 Aug 2023 18:45:05 GMT"
],
"NEL": [
"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}"
],
"Report-To": [
"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=0V465e7Z7GqXSIkQOm7dYm27znEGUOxk61p7MekIQAMFqxcb0Bwln3M4lY7hMrgr60b0%2F3Ixg9SE8AN1%2FC0oL8ZwNUB2leX1Q3ZfU7g9t3Xxa%2BpNSFKiEiiHKbnuPnfOyYrpM6Jmvw%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}"
"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=93pKtZnTiN0zXhgkLknIL0s8cm8eYAj2rmNYCI1a8bxPBkWBxGdx6pBPBVM77UHrhj%2BGqZX%2B6iSLOlSuZZa3PPcu%2FTvcpM%2Fc%2FGNn8mOlDl32RzRTFhHRPZXG%2B%2BNCDOjOx4znCacCeTGyv3nhYeQ%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}"
],
"Server": [
"cloudflare"
Expand All @@ -79,23 +79,22 @@
"max-age=0, private, must-revalidate"
],
"etag": [
"W/\"604e0d150059d1aa7d4f5987694b06f4\""
"W/\"21037def0006e5ec0664ae3a708c38cf\""
],
"location": [
"https://d3v-zenpydev.zendesk.com/api/v2/attachments/13120610139410.json"
"https://d3v-zenpydev.zendesk.com/api/v2/attachments/6097502017050.json"
],
"rate-limit": [
"700"
],
"rate-limit-remaining": [
"655"
"685"
],
"rate-limit-reset": [
"29"
"55"
],
"set-cookie": [
"_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=/; expires=Fri, 16 Aug 2024 14:08:37 GMT; secure; HttpOnly; SameSite=None",
"__cfruid=cd1b4a442dc1f466a75849c08cd4c6c89d1c06fb-1692197671; path=/; domain=.d3v-ontec.zendesk.com; HttpOnly; Secure; SameSite=None"
"_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=/; expires=Sat, 31 Aug 2024 18:44:36 GMT; secure; HttpOnly; SameSite=None"
],
"strict-transport-security": [
"max-age=31536000; includeSubDomains"
Expand All @@ -107,23 +106,23 @@
"700"
],
"x-rate-limit-remaining": [
"655"
"685"
],
"x-request-id": [
"7f7a8350dc202e01-ARN",
"7f7a8350dc202e01-ARN"
"7ff76dafbfefeb4b-SEA",
"7ff76dafbfefeb4b-SEA"
],
"x-runtime": [
"0.284166"
"0.243619"
],
"x-zendesk-api-version": [
"v2"
],
"x-zendesk-application-version": [
"v17988"
"v18239"
],
"x-zendesk-origin-server": [
"classic-app-server-8589bd8f84-wccq5"
"classic-app-server-566774b49d-pcdff"
]
},
"status": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"http_interactions": [
{
"recorded_at": "2023-08-16T14:54:31",
"recorded_at": "2023-08-31T18:45:05",
"request": {
"body": {
"encoding": "utf-8",
Expand All @@ -21,16 +21,16 @@
"keep-alive"
],
"Content-Length": [
"14338"
"13762"
],
"Content-Type": [
"application/octet-stream"
],
"Cookie": [
"__cfruid=cd1b4a442dc1f466a75849c08cd4c6c89d1c06fb-1692197671; _zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca"
"_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca"
],
"User-Agent": [
"Zenpy/2.0.27"
"Zenpy/2.0.34"
]
},
"method": "POST",
Expand All @@ -39,32 +39,32 @@
"response": {
"body": {
"encoding": "utf-8",
"string": "{\"upload\":{\"token\":\"avKJBmOFlU3R50C5hiPr67BMt\",\"expires_at\":\"2023-08-19T14:54:31Z\",\"attachments\":[{\"url\":\"https://d3v-zenpydev.zendesk.com/api/v2/attachments/13120664634514.json\",\"id\":13120664634514,\"file_name\":\"README.md\",\"content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/BtzZgrcdaankh9t0PH1OiFQ31/?name=README.md\",\"mapped_content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/BtzZgrcdaankh9t0PH1OiFQ31/?name=README.md\",\"content_type\":\"application/x-genesis-rom\",\"size\":14338,\"width\":null,\"height\":null,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[]}],\"attachment\":{\"url\":\"https://d3v-zenpydev.zendesk.com/api/v2/attachments/13120664634514.json\",\"id\":13120664634514,\"file_name\":\"README.md\",\"content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/BtzZgrcdaankh9t0PH1OiFQ31/?name=README.md\",\"mapped_content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/BtzZgrcdaankh9t0PH1OiFQ31/?name=README.md\",\"content_type\":\"application/x-genesis-rom\",\"size\":14338,\"width\":null,\"height\":null,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[]}}}"
"string": "{\"upload\":{\"token\":\"Bo1TpUzIIQulTQ7x9EJDhsxNk\",\"expires_at\":\"2023-09-03T18:45:05Z\",\"attachments\":[{\"url\":\"https://d3v-zenpydev.zendesk.com/api/v2/attachments/6097506614170.json\",\"id\":6097506614170,\"file_name\":\"README.md\",\"content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/DYOfxy6FtDj1HxzcF9rKuiDkK/?name=README.md\",\"mapped_content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/DYOfxy6FtDj1HxzcF9rKuiDkK/?name=README.md\",\"content_type\":\"application/x-genesis-rom\",\"size\":13762,\"width\":null,\"height\":null,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[]}],\"attachment\":{\"url\":\"https://d3v-zenpydev.zendesk.com/api/v2/attachments/6097506614170.json\",\"id\":6097506614170,\"file_name\":\"README.md\",\"content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/DYOfxy6FtDj1HxzcF9rKuiDkK/?name=README.md\",\"mapped_content_url\":\"https://d3v-zenpydev.zendesk.com/attachments/token/DYOfxy6FtDj1HxzcF9rKuiDkK/?name=README.md\",\"content_type\":\"application/x-genesis-rom\",\"size\":13762,\"width\":null,\"height\":null,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[]}}}"
},
"headers": {
"CF-Cache-Status": [
"DYNAMIC"
],
"CF-RAY": [
"7f7a83589cbe2e01-ARN"
"7ff76db51f55eb4b-SEA"
],
"Connection": [
"keep-alive"
],
"Content-Length": [
"1193"
"1231"
],
"Content-Type": [
"text/plain; charset=utf-8"
],
"Date": [
"Wed, 16 Aug 2023 14:54:32 GMT"
"Thu, 31 Aug 2023 18:45:05 GMT"
],
"NEL": [
"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}"
],
"Report-To": [
"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=F1n32giwAfia6QK%2FsUjvUPUsigUiPm4vyMq%2F%2FUxW4VX5K%2BidFly86NuMcHGlvIrr2fsIsGyOuetKG0cRiS9J1MbR4vRk3TML9oDwu9FXahPiVDc2KJe4VnqDDOlRMMP1ekx5FLnfxA%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}"
"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=U2GmkRBaG5PMhii6%2F6GUxkHdgmxclL68flIVrrYPEbUuUWc17kMr9BC%2FTnyu5VTHCDDN0zy7cMtRibVwYqWDOdD6cTEqHWdoL2WNtIydX4RcmVKXyGF%2FhONotmUjreNPib7RJ3F%2FZa0srvaURHs%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}"
],
"Server": [
"cloudflare"
Expand All @@ -82,19 +82,19 @@
"max-age=0, private, must-revalidate"
],
"etag": [
"W/\"a3027b8738cb070be26564c64aa2fbb8\""
"W/\"36affbe8f2a2b72ca81f9d0de1a80236\""
],
"location": [
"https://d3v-zenpydev.zendesk.com/api/v2/attachments/13120664634514.json"
"https://d3v-zenpydev.zendesk.com/api/v2/attachments/6097506614170.json"
],
"rate-limit": [
"700"
],
"rate-limit-remaining": [
"654"
"684"
],
"rate-limit-reset": [
"28"
"55"
],
"strict-transport-security": [
"max-age=31536000; includeSubDomains"
Expand All @@ -106,23 +106,23 @@
"700"
],
"x-rate-limit-remaining": [
"654"
"684"
],
"x-request-id": [
"7f7a83589cbe2e01-ARN",
"7f7a83589cbe2e01-ARN"
"7ff76db51f55eb4b-SEA",
"7ff76db51f55eb4b-SEA"
],
"x-runtime": [
"0.194434"
"0.247172"
],
"x-zendesk-api-version": [
"v2"
],
"x-zendesk-application-version": [
"v17988"
"v18239"
],
"x-zendesk-origin-server": [
"classic-app-server-8589bd8f84-n2lfk"
"classic-app-server-566774b49d-qkdkq"
]
},
"status": {
Expand Down
Loading

0 comments on commit 67562c6

Please sign in to comment.