Skip to content

Commit

Permalink
Merge branch 'master' into aggregate-when-filter-return-empty
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino authored Mar 7, 2025
2 parents 6c338ac + 11cf2b4 commit 11a03f7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 86 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/cdf_auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ jobs:
strategy:
fail-fast: false
matrix:
config_env: ["contributor", "prod"]
cdf_project: ["python-sdk-contributor", "python-sdk-test-prod"]
container:
image: cognite/toolkit:0.4.9
env:
CDF_CLUSTER: ${{ vars.CDF_CLUSTER_CD }}
CDF_PROJECT: ${{ vars.CDF_PROJECT_CD }}
CDF_PROJECT: ${{ matrix.cdf_project }}
IDP_CLIENT_ID: ${{ vars.IDP_CLIENT_ID_CD }}
IDP_CLIENT_SECRET: ${{ secrets.IDP_CLIENT_SECRET_CD }}
IDP_TENANT_ID: ${{ vars.IDP_TENANT_ID_CD }}
PROVIDER: "entra_id"
LOGIN_FLOW: "client_credentials"
steps:
- uses: actions/checkout@v4
- name: Build the CDF Groups
working-directory: scripts/toolkit
run: cdf build --env ${{ matrix.config_env }}
run: cdf build --env ${{ matrix.cdf_project }}
- name: Update CDF Auth
working-directory: scripts/toolkit
run: cdf deploy
68 changes: 0 additions & 68 deletions scripts/add_capability.py

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/toolkit/cdf.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolkit]
default_env = "contributor"
default_env = "python-sdk-contributor"

[plugins]
run = true
Expand Down
File renamed without changes.
File renamed without changes.
23 changes: 10 additions & 13 deletions tests/tests_integration/test_api/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,9 @@ def abc_files(cognite_client: CogniteClient) -> FileMetadataList:
if missing := (set(files.as_external_ids()) - set(retrieved.as_external_ids())):
for local in files:
if local.external_id in missing:
created, _ = cognite_client.files.create(local)
_ = cognite_client.files.upload_bytes(
created = cognite_client.files.upload_bytes(
content=local.name.removesuffix(".txt"),
external_id=local.external_id,
**local.dump(camel_case=False),
)
retrieved.append(created)

Expand All @@ -109,17 +108,15 @@ def abc_files(cognite_client: CogniteClient) -> FileMetadataList:
def big_txt(cognite_client: CogniteClient) -> FileMetadata:
file = cognite_client.files.retrieve(external_id="big_txt")
if file is None:
created, _ = cognite_client.files.create(
FileMetadataWrite(
name="big.txt",
external_id="big_txt",
directory="/test",
mime_type="text/plain",
)
local = FileMetadataWrite(
name="big.txt",
external_id="big_txt",
directory="/test",
mime_type="text/plain",
)
_ = cognite_client.files.upload_bytes(
created = cognite_client.files.upload_bytes(
content="big" * 30_000_000,
external_id="big_txt",
**local.dump(camel_case=False),
)
file = created
return file
Expand Down Expand Up @@ -225,7 +222,7 @@ def test_update_directory(self, cognite_client, new_file):
res = cognite_client.files.update(FileMetadata(id=new_file.id, directory=dir))
assert res.directory == dir

def test_download(self, cognite_client, test_files):
def test_download(self, cognite_client: CogniteClient, test_files: dict[str, FileMetadata]) -> None:
test_file = test_files["a.txt"]
res = cognite_client.files.download_bytes(id=test_file.id)
assert b"a" == res
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_unit/test_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_headers_correct(self, mock_all_requests_ok, api_client_with_token):
api_client_with_token._post(URL_PATH, {"any": "OK"}, headers={"additional": "stuff"})
headers = mock_all_requests_ok.calls[0].request.headers

assert "gzip, deflate, zstd" == headers["accept-encoding"]
assert {"gzip", "deflate"} <= {encoding.strip() for encoding in headers["accept-encoding"].split(",")}
assert "gzip" == headers["content-encoding"]
assert f"CognitePythonSDK:{utils._auxiliary.get_current_sdk_version()}" == headers["x-cdp-sdk"]
assert "Bearer abc" == headers["Authorization"]
Expand Down

0 comments on commit 11a03f7

Please sign in to comment.