Skip to content

Commit

Permalink
Refractor
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielschowe committed Sep 18, 2024
1 parent 22af021 commit 98d2ff0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions pontos/github/api/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,19 @@ async def package_versions(
) -> AsyncIterator[PackageVersion]:
"""
Get information about package versions
https://docs.github.com/en/rest/reference/packages#list-package-versions-for-an-organization
Args:
organization: GitHub organization to use
package_type: Type of the package to get
package_name: Name of the package to get
Raises:
`httpx.HTTPStatusError`: If there was an error in the request
Returns:
An async iterator yielding package versions
Expand Down Expand Up @@ -349,7 +351,9 @@ async def delete_package_with_tag(
tag="latest",
)
"""
async for package_version in self.package_versions(organization, package_type, package_name):
async for package_version in self.package_versions(
organization, package_type, package_name
):
if tag in package_version.tags:
api = f"/orgs/{organization}/packages/{package_type}/{package_name}/versions/{package_version.id}"
response = await self._client.delete(api)

Check warning on line 359 in pontos/github/api/packages.py

View check run for this annotation

Codecov / codecov/patch

pontos/github/api/packages.py#L358-L359

Added lines #L358 - L359 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion tests/github/api/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ async def test_delete_package_with_tag(self):
"/orgs/foo/packages/container/bar/versions/tags/latest"
)

async def test_package_versions(self):
async def test_package_versions(self):
response1 = create_response()
response1.json.return_value = [PACKAGE_VERSION]
response2 = create_response()
Expand Down

0 comments on commit 98d2ff0

Please sign in to comment.