Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13100,12 +13100,17 @@ components:
minLength: 1
type: string
repository_id:
description: The repository identifier.
deprecated: true
description: "Deprecated: use `repository_url` instead. The repository URL."
example: github.com/datadog/shopist
minLength: 1
type: string
repository_url:
description: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`).
example: https://github.com/datadog/shopist
minLength: 1
type: string
required:
- repository_id
- branch
type: object
BranchCoverageSummaryRequestData:
Expand Down Expand Up @@ -19067,12 +19072,17 @@ components:
pattern: "^[a-fA-F0-9]{40}$"
type: string
repository_id:
description: The repository identifier.
deprecated: true
description: "Deprecated: use `repository_url` instead. The repository URL."
example: github.com/datadog/shopist
minLength: 1
type: string
repository_url:
description: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`).
example: https://github.com/datadog/shopist
minLength: 1
type: string
required:
- repository_id
- commit_sha
type: object
CommitCoverageSummaryRequestData:
Expand Down Expand Up @@ -122130,7 +122140,7 @@ paths:
data:
attributes:
branch: prod
repository_id: github.com/datadog/test-service
repository_url: https://github.com/datadog/test-service
type: ci_app_coverage_branch_summary_request
schema:
$ref: "#/components/schemas/BranchCoverageSummaryRequest"
Expand Down Expand Up @@ -122200,7 +122210,7 @@ paths:
data:
attributes:
commit_sha: 66adc9350f2cc9b250b69abddab733dd55e1a588
repository_id: github.com/datadog/test-service
repository_url: https://github.com/datadog/test-service
type: ci_app_coverage_commit_summary_request
schema:
$ref: "#/components/schemas/CommitCoverageSummaryRequest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
attributes=BranchCoverageSummaryRequestAttributes(
branch="prod",
repository_id="github.com/datadog/shopist",
repository_url="https://github.com/datadog/shopist",
),
type=BranchCoverageSummaryRequestType.CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
attributes=CommitCoverageSummaryRequestAttributes(
commit_sha="66adc9350f2cc9b250b69abddab733dd55e1a588",
repository_id="github.com/datadog/shopist",
repository_url="https://github.com/datadog/shopist",
),
type=CommitCoverageSummaryRequestType.CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


Expand All @@ -18,31 +21,48 @@ class BranchCoverageSummaryRequestAttributes(ModelNormal):
"repository_id": {
"min_length": 1,
},
"repository_url": {
"min_length": 1,
},
}

@cached_property
def openapi_types(_):
return {
"branch": (str,),
"repository_id": (str,),
"repository_url": (str,),
}

attribute_map = {
"branch": "branch",
"repository_id": "repository_id",
"repository_url": "repository_url",
}

def __init__(self_, branch: str, repository_id: str, **kwargs):
def __init__(
self_,
branch: str,
repository_id: Union[str, UnsetType] = unset,
repository_url: Union[str, UnsetType] = unset,
**kwargs,
):
"""
Attributes for requesting code coverage summary for a branch.

:param branch: The branch name.
:type branch: str

:param repository_id: The repository identifier.
:type repository_id: str
:param repository_id: Deprecated: use ``repository_url`` instead. The repository URL. **Deprecated**.
:type repository_id: str, optional

:param repository_url: The repository URL. Accepts a full URL with or without a scheme (for example, ``https://github.com/org/repo`` or ``github.com/org/repo`` ).
:type repository_url: str, optional
"""
if repository_id is not unset:
kwargs["repository_id"] = repository_id
if repository_url is not unset:
kwargs["repository_url"] = repository_url
super().__init__(kwargs)

self_.branch = branch
self_.repository_id = repository_id
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


Expand All @@ -16,31 +19,48 @@ class CommitCoverageSummaryRequestAttributes(ModelNormal):
"repository_id": {
"min_length": 1,
},
"repository_url": {
"min_length": 1,
},
}

@cached_property
def openapi_types(_):
return {
"commit_sha": (str,),
"repository_id": (str,),
"repository_url": (str,),
}

attribute_map = {
"commit_sha": "commit_sha",
"repository_id": "repository_id",
"repository_url": "repository_url",
}

def __init__(self_, commit_sha: str, repository_id: str, **kwargs):
def __init__(
self_,
commit_sha: str,
repository_id: Union[str, UnsetType] = unset,
repository_url: Union[str, UnsetType] = unset,
**kwargs,
):
"""
Attributes for requesting code coverage summary for a commit.

:param commit_sha: The commit SHA (40-character hexadecimal string).
:type commit_sha: str

:param repository_id: The repository identifier.
:type repository_id: str
:param repository_id: Deprecated: use ``repository_url`` instead. The repository URL. **Deprecated**.
:type repository_id: str, optional

:param repository_url: The repository URL. Accepts a full URL with or without a scheme (for example, ``https://github.com/org/repo`` or ``github.com/org/repo`` ).
:type repository_url: str, optional
"""
if repository_id is not unset:
kwargs["repository_id"] = repository_id
if repository_url is not unset:
kwargs["repository_url"] = repository_url
super().__init__(kwargs)

self_.commit_sha = commit_sha
self_.repository_id = repository_id
12 changes: 6 additions & 6 deletions tests/v2/features/code_coverage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ Feature: Code Coverage
Scenario: Get code coverage summary for a branch returns "Bad Request" response
Given operation "GetCodeCoverageBranchSummary" enabled
And new "GetCodeCoverageBranchSummary" request
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get code coverage summary for a branch returns "Not Found" response
Given operation "GetCodeCoverageBranchSummary" enabled
And new "GetCodeCoverageBranchSummary" request
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get code coverage summary for a branch returns "OK" response
Given operation "GetCodeCoverageBranchSummary" enabled
And new "GetCodeCoverageBranchSummary" request
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
When the request is sent
Then the response status is 200 OK

Expand Down Expand Up @@ -61,23 +61,23 @@ Feature: Code Coverage
Scenario: Get code coverage summary for a commit returns "Bad Request" response
Given operation "GetCodeCoverageCommitSummary" enabled
And new "GetCodeCoverageCommitSummary" request
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get code coverage summary for a commit returns "Not Found" response
Given operation "GetCodeCoverageCommitSummary" enabled
And new "GetCodeCoverageCommitSummary" request
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get code coverage summary for a commit returns "OK" response
Given operation "GetCodeCoverageCommitSummary" enabled
And new "GetCodeCoverageCommitSummary" request
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
When the request is sent
Then the response status is 200 OK

Expand Down
Loading