Skip to content

Commit

Permalink
Fix tests and update cassettes (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramnes authored Dec 30, 2024
1 parent 12334b2 commit d07ce47
Show file tree
Hide file tree
Showing 41 changed files with 635 additions and 627 deletions.
3 changes: 3 additions & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ pytest-asyncio
pytest-cov
pytest-timeout
pytest-vcr

# I'm unable to use vcrpy 6.x cassettes (UnicodeDecodeError on JSON body), let's try again later
vcrpy<6
2 changes: 1 addition & 1 deletion tests/cassettes/test_api_response_error.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interactions:
uri: https://api.notion.com/v1/users
response:
content: '{"object":"error","status":401,"code":"unauthorized","message":"API
token is invalid.","request_id":"da934f68-ceb1-42a9-b0e4-6f254572d4aa"}'
token is invalid.","request_id":"3db4e917-1be1-49a5-bfcd-f5339a6a8d4f"}'
headers: {}
http_version: HTTP/1.1
status_code: 401
Expand Down
2 changes: 1 addition & 1 deletion tests/cassettes/test_async_api_response_error.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interactions:
uri: https://api.notion.com/v1/users
response:
content: '{"object":"error","status":401,"code":"unauthorized","message":"API
token is invalid.","request_id":"38daaeec-a2c3-4d66-baf8-795cf5bd787e"}'
token is invalid.","request_id":"f12c8893-f690-44c3-88d3-6ab25b1804c8"}'
headers: {}
http_version: HTTP/1.1
status_code: 401
Expand Down
2 changes: 1 addition & 1 deletion tests/cassettes/test_async_client_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interactions:
uri: https://api.notion.com/v1/users
response:
content: '{"object":"list","results":[{"object":"user","id":"a4f789cc-7bc8-4cf0-82b9-a8ba7d985ecf","name":"Guillaume
Gelin","avatar_url":"https://s3-us-west-2.amazonaws.com/public.notion-static.com/01d7053d-e135-4f27-bba0-5de532d39296/ramnes3.jpeg","type":"person","person":{"email":"[email protected]"}},{"object":"user","id":"7775f3a3-893f-43fa-b625-460c61094c78","name":"notion-sdk-py","avatar_url":null,"type":"bot","bot":{"owner":{"type":"workspace","workspace":true},"workspace_name":"notion-sdk-py"}}],"next_cursor":null,"has_more":false,"type":"user","user":{},"request_id":"b896c45a-4b3c-4c1d-8f74-74c918277563"}'
Gelin","avatar_url":"https://s3-us-west-2.amazonaws.com/public.notion-static.com/01d7053d-e135-4f27-bba0-5de532d39296/ramnes3.jpeg","type":"person","person":{"email":"[email protected]"}},{"object":"user","id":"7775f3a3-893f-43fa-b625-460c61094c78","name":"notion-sdk-py","avatar_url":null,"type":"bot","bot":{"owner":{"type":"workspace","workspace":true},"workspace_name":"notion-sdk-py"}}],"next_cursor":null,"has_more":false,"type":"user","user":{},"request_id":"2a76c63f-ab19-45ef-88af-e043f3baa4ca"}'
headers: {}
http_version: HTTP/1.1
status_code: 200
Expand Down
4 changes: 2 additions & 2 deletions tests/cassettes/test_async_client_request_auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interactions:
uri: https://api.notion.com/v1/users
response:
content: '{"object":"error","status":401,"code":"unauthorized","message":"API
token is invalid.","request_id":"55e52eed-c17d-4695-8cde-49e01bb83990"}'
token is invalid.","request_id":"9edc0732-7262-4130-bb9d-1d95030beb0f"}'
headers: {}
http_version: HTTP/1.1
status_code: 401
Expand All @@ -41,7 +41,7 @@ interactions:
uri: https://api.notion.com/v1/users
response:
content: '{"object":"list","results":[{"object":"user","id":"a4f789cc-7bc8-4cf0-82b9-a8ba7d985ecf","name":"Guillaume
Gelin","avatar_url":"https://s3-us-west-2.amazonaws.com/public.notion-static.com/01d7053d-e135-4f27-bba0-5de532d39296/ramnes3.jpeg","type":"person","person":{"email":"[email protected]"}},{"object":"user","id":"7775f3a3-893f-43fa-b625-460c61094c78","name":"notion-sdk-py","avatar_url":null,"type":"bot","bot":{"owner":{"type":"workspace","workspace":true},"workspace_name":"notion-sdk-py"}}],"next_cursor":null,"has_more":false,"type":"user","user":{},"request_id":"4230ed69-a603-4427-b878-1417970f557c"}'
Gelin","avatar_url":"https://s3-us-west-2.amazonaws.com/public.notion-static.com/01d7053d-e135-4f27-bba0-5de532d39296/ramnes3.jpeg","type":"person","person":{"email":"[email protected]"}},{"object":"user","id":"7775f3a3-893f-43fa-b625-460c61094c78","name":"notion-sdk-py","avatar_url":null,"type":"bot","bot":{"owner":{"type":"workspace","workspace":true},"workspace_name":"notion-sdk-py"}}],"next_cursor":null,"has_more":false,"type":"user","user":{},"request_id":"20f2acad-35c1-443d-89e4-6b7929b523ab"}'
headers: {}
http_version: HTTP/1.1
status_code: 200
Expand Down
8 changes: 4 additions & 4 deletions tests/cassettes/test_async_collect_paginated_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ interactions:
method: POST
uri: https://api.notion.com/v1/search
response:
content: '{"object":"list","results":[{"object":"page","id":"95ba0116-6776-4c19-9e45-54e77415f03b","created_time":"2023-06-29T12:47:00.000Z","last_edited_time":"2023-12-25T21:51:00.000Z","created_by":{"object":"user","id":"a4f789cc-7bc8-4cf0-82b9-a8ba7d985ecf"},"last_edited_by":{"object":"user","id":"7775f3a3-893f-43fa-b625-460c61094c78"},"cover":null,"icon":null,"parent":{"type":"workspace","workspace":true},"archived":false,"properties":{"title":{"id":"title","type":"title","title":[]}},"url":"https://www.notion.so/95ba011667764c199e4554e77415f03b","public_url":null}],"next_cursor":null,"has_more":false,"type":"page_or_database","page_or_database":{},"request_id":"199e29d6-fd4c-45f5-ad45-cad7bdcde213"}'
content: '{"object":"list","results":[{"object":"page","id":"95ba0116-6776-4c19-9e45-54e77415f03b","created_time":"2023-06-29T12:47:00.000Z","last_edited_time":"2024-12-30T17:10:00.000Z","created_by":{"object":"user","id":"a4f789cc-7bc8-4cf0-82b9-a8ba7d985ecf"},"last_edited_by":{"object":"user","id":"7775f3a3-893f-43fa-b625-460c61094c78"},"cover":null,"icon":null,"parent":{"type":"workspace","workspace":true},"archived":false,"in_trash":false,"properties":{"title":{"id":"title","type":"title","title":[]}},"url":"https://www.notion.so/95ba011667764c199e4554e77415f03b","public_url":null}],"next_cursor":null,"has_more":false,"type":"page_or_database","page_or_database":{},"request_id":"a1c6c917-2851-4ab0-afdb-38b6ca7c12f0"}'
headers: {}
http_version: HTTP/1.1
status_code: 200
- request:
body: '{"query": "This should have no results"}'
body: '{"query":"This should have no results"}'
headers:
accept:
- '*/*'
Expand All @@ -37,7 +37,7 @@ interactions:
connection:
- keep-alive
content-length:
- '40'
- '39'
content-type:
- application/json
host:
Expand All @@ -47,7 +47,7 @@ interactions:
method: POST
uri: https://api.notion.com/v1/search
response:
content: '{"object":"list","results":[],"next_cursor":null,"has_more":false,"type":"page_or_database","page_or_database":{},"request_id":"2b07b4e1-ef07-4bfc-9765-b3e44f5201c8"}'
content: '{"object":"list","results":[],"next_cursor":null,"has_more":false,"type":"page_or_database","page_or_database":{},"request_id":"e3461425-bfff-46d3-ad59-0aa997592b35"}'
headers: {}
http_version: HTTP/1.1
status_code: 200
Expand Down
Loading

0 comments on commit d07ce47

Please sign in to comment.