Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: test for packages API from github #1049

Merged
merged 75 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
d6da5ff
Add: packages API from github
y0urself Apr 25, 2024
b9cc903
Refactor: Reuse JSON instead of hardcoding every occurance ...
y0urself May 8, 2024
82b682d
WiP: Add tests, test functionallity
y0urself May 16, 2024
cbf04de
Add: Test script to get the ID of a package with a specific tag.
y0urself May 17, 2024
69e23bd
Fix tests
y0urself May 17, 2024
0db75d6
Add test for package_versions
y0urself May 17, 2024
28242a0
Add: Test for package_version_tags
gabrielschowe Sep 16, 2024
55a69af
Change: Some typo
gabrielschowe Sep 16, 2024
f941ada
Test: debugging for packages.py error
gabrielschowe Sep 17, 2024
b7947a5
Add: Tests for delete and tags
gabrielschowe Sep 17, 2024
60f6a3e
Fix: Local pathfinding not working on github
gabrielschowe Sep 17, 2024
48638b6
Fix: Indentation
gabrielschowe Sep 17, 2024
037aaa1
Refractor
gabrielschowe Sep 17, 2024
210a9cf
Remove: Broken code to check other tests
gabrielschowe Sep 17, 2024
4d05fc4
Change: Removed unnecessary print
gabrielschowe Sep 17, 2024
0cc05dc
Add: test_delete_package
gabrielschowe Sep 17, 2024
5919948
Add: test_delete_package_version_tag
gabrielschowe Sep 17, 2024
87e6899
Add: Test for Api.py line 129
gabrielschowe Sep 17, 2024
c19d5bd
Change:Debugging delete_package_version_tag
gabrielschowe Sep 17, 2024
d152529
Fix:Package_version missing
gabrielschowe Sep 17, 2024
867a37a
Remove: Package self check
gabrielschowe Sep 17, 2024
69b9292
Add: Print tags
gabrielschowe Sep 18, 2024
d2f0c43
Removed: Test
gabrielschowe Sep 18, 2024
e9b8d1c
Add: Delete package(s) with specific tag
gabrielschowe Sep 18, 2024
fc30e0b
Fix: Newline and iterator
gabrielschowe Sep 18, 2024
31350ba
Fix: Function not existing so i removed the call
gabrielschowe Sep 18, 2024
71084f7
Fix: missing await
gabrielschowe Sep 18, 2024
66a4dcd
Fix: Iterator type error
gabrielschowe Sep 18, 2024
d2f4393
Fix: missing async
gabrielschowe Sep 18, 2024
b45b316
Fix: Async Iterator
gabrielschowe Sep 18, 2024
8392791
Fix: Iterator
gabrielschowe Sep 18, 2024
6a8ebe9
A commit
gabrielschowe Sep 18, 2024
04b4cb6
Iterator
gabrielschowe Sep 18, 2024
09fb00c
Change: Different try on iterator
gabrielschowe Sep 18, 2024
fe34da1
Get_All
gabrielschowe Sep 18, 2024
57e6596
New tests
gabrielschowe Sep 18, 2024
cc18294
Iterator stuff
gabrielschowe Sep 18, 2024
5e776f3
Change: Change package_versions back to old version
gabrielschowe Sep 18, 2024
52d4d43
Change: New try
gabrielschowe Sep 18, 2024
56907f5
Fix: Test_package_versions
gabrielschowe Sep 18, 2024
d72f249
Refractor
gabrielschowe Sep 18, 2024
9f8f8bb
Refractor
gabrielschowe Sep 18, 2024
56e2e1d
Refractor
gabrielschowe Sep 18, 2024
1844048
Refractor
gabrielschowe Sep 18, 2024
7638455
Some debugging
gabrielschowe Sep 18, 2024
31d822c
Debug: Type fail
gabrielschowe Sep 18, 2024
3be19af
Type fixes
gabrielschowe Sep 18, 2024
f3cfa29
Type problemes
gabrielschowe Sep 18, 2024
a02af4b
Change: Updated the test_delete_package_with_tag
gabrielschowe Sep 18, 2024
982178d
Remove: Duplicated test
gabrielschowe Sep 18, 2024
5939e74
Fix: Test had wront wait
gabrielschowe Sep 18, 2024
e59b25e
Remove: Unnecessary test
gabrielschowe Sep 18, 2024
77f360e
Refractor: imports
gabrielschowe Sep 18, 2024
fce9564
Add: Extended tests
gabrielschowe Sep 19, 2024
b2f1f52
Fix: Container was in lower case
gabrielschowe Sep 19, 2024
d49ca47
Fix: wrong url for second delete
gabrielschowe Sep 19, 2024
3347ead
Change: Moved the failuretest
gabrielschowe Sep 19, 2024
ac85d57
Add: test for lines
gabrielschowe Sep 19, 2024
57b6096
Remove: Not working tests
gabrielschowe Sep 19, 2024
e498c25
Remove: Unnecessary code block
gabrielschowe Sep 19, 2024
95b6408
Change: Code cleanup
gabrielschowe Sep 19, 2024
3ebaa8d
Delete awaited once still failing
gabrielschowe Sep 19, 2024
b84a0b5
Debugging
gabrielschowe Sep 19, 2024
21af8a4
Debugging
gabrielschowe Sep 19, 2024
999240f
Debugging
gabrielschowe Sep 19, 2024
8de7ed0
Debugging
gabrielschowe Sep 19, 2024
23fd2cf
Remove:trailing spaces
gabrielschowe Sep 19, 2024
526a6d2
Remove: Trailing spaces
gabrielschowe Sep 19, 2024
88b2a21
Test package_version_delete and package_version_tags
y0urself Sep 20, 2024
cce53d8
Commit for staging
gabrielschowe Sep 23, 2024
5d1b1d4
Add: working unit tests, Refractor
gabrielschowe Sep 23, 2024
27c8a23
Add: Script to use delete by tag
gabrielschowe Sep 23, 2024
8f921d4
Refractor: packages.py, delete-package-with-tag.py, test_packages.py
gabrielschowe Sep 23, 2024
75159ac
Refractor: delete-package-with-tag
gabrielschowe Sep 23, 2024
fec5e5a
Remove: Unnecessary prints
gabrielschowe Sep 24, 2024
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
2 changes: 2 additions & 0 deletions pontos/github/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)
from .labels import GitHubAsyncRESTLabels
from .organizations import GitHubAsyncRESTOrganizations
from .packages import GitHubAsyncRESTPackages
from .pull_requests import GitHubAsyncRESTPullRequests
from .release import GitHubAsyncRESTReleases
from .repositories import GitHubAsyncRESTRepositories
Expand All @@ -39,6 +40,7 @@
"GitHubAsyncRESTDependabot",
"GitHubAsyncRESTLabels",
"GitHubAsyncRESTOrganizations",
"GitHubAsyncRESTPackages",
"GitHubAsyncRESTPullRequests",
"GitHubAsyncRESTReleases",
"GitHubAsyncRESTRepositories",
Expand Down
8 changes: 8 additions & 0 deletions pontos/github/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
)
from pontos.github.api.labels import GitHubAsyncRESTLabels
from pontos.github.api.organizations import GitHubAsyncRESTOrganizations
from pontos.github.api.packages import GitHubAsyncRESTPackages
from pontos.github.api.pull_requests import GitHubAsyncRESTPullRequests
from pontos.github.api.release import GitHubAsyncRESTReleases
from pontos.github.api.repositories import GitHubAsyncRESTRepositories
Expand Down Expand Up @@ -120,6 +121,13 @@
"""
return GitHubAsyncRESTLabels(self._client)

@property
def packages(self) -> GitHubAsyncRESTPackages:
"""
Packages related API
"""
return GitHubAsyncRESTPackages(self._client)

Check warning on line 129 in pontos/github/api/api.py

View check run for this annotation

Codecov / codecov/patch

pontos/github/api/api.py#L129

Added line #L129 was not covered by tests

@property
@deprecated(
since="23.3.4",
Expand Down
54 changes: 54 additions & 0 deletions pontos/github/api/foo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
'id': 4917607,
'name': 'asset-management-backend',
'package_type': 'container',
'owner': {
'login': 'greenbone',
'id': 31986857,
'node_id': 'MDEyOk9yZ2FuaXphdGlvbjMxOTg2ODU3',
'avatar_url': 'https: //avatars.githubusercontent.com/u/31986857?v=4',
'gravatar_id': '',
'url': 'https://api.github.com/users/greenbone',
'html_url': 'https://github.com/greenbone',
'followers_url': 'https://api.github.com/users/greenbone/followers',
'following_url': 'https://api.github.com/users/greenbone/following{/other_user}',
'gists_url': 'https://api.github.com/users/greenbone/gists{/gist_id}',
'starred_url': 'https://api.github.com/users/greenbone/starred{/owner}{/repo}',
'subscriptions_url': 'https://api.github.com/users/greenbone/subscriptions', 'organizations_url': 'https://api.github.com/users/greenbone/orgs', 'repos_url': 'https://api.github.com/users/greenbone/repos', 'events_url': 'https://api.github.com/users/greenbone/events{/privacy}', 'received_events_url': 'https://api.github.com/users/greenbone/received_events', 'type': 'Organization', 'site_admin': False
},
'version_count': 7686,
'visibility': 'public',
'url': 'https://api.github.com/orgs/greenbone/packages/container/asset-management-backend',
'created_at': '2023-03-16T14:39:23Z',
'updated_at': '2024-05-06T07:46:34Z',
'repository': {
'id': 498688333,
'node_id': 'R_kgDOHblhTQ',
'name': 'asset-management-backend',
'full_name': 'greenbone/asset-management-backend',
'private': True,
'owner': {'login': 'greenbone', 'id': 31986857, 'node_id': 'MDEyOk9yZ2FuaXphdGlvbjMxOTg2ODU3', 'avatar_url': 'https://avatars.githubusercontent.com/u/31986857?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/greenbone', 'html_url': 'https://github.com/greenbone', 'followers_url': 'https://api.github.com/users/greenbone/followers', 'following_url': 'https://api.github.com/users/greenbone/following{/other_user}', 'gists_url': 'https://api.github.com/users/greenbone/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/greenbone/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/greenbone/subscriptions', 'organizations_url': 'https://api.github.com/users/greenbone/orgs', 'repos_url': 'https://api.github.com/users/greenbone/repos', 'events_url': 'https://api.github.com/users/greenbone/events{/privacy}', 'received_events_url': 'https://api.github.com/users/greenbone/received_events', 'type': 'Organization', 'site_admin': False
},
'html_url': 'https://github.com/greenbone/asset-management-backend',
'description': 'Backend for the asset-management-frontend that provides REST endpoints with the main functionality of the Opensight Asset product.',
'fork': False,
'url': 'https://api.github.com/repos/greenbone/asset-management-backend',
'forks_url': 'https://api.github.com/repos/greenbone/asset-management-backend/forks',
'keys_url': 'https://api.github.com/repos/greenbone/asset-management-backend/keys{/key_id}',
'collaborators_url': 'https://api.github.com/repos/greenbone/asset-management-backend/collaborators{/collaborator}',
'teams_url': 'https://api.github.com/repos/greenbone/asset-management-backend/teams',
'hooks_url': 'https://api.github.com/repos/greenbone/asset-management-backend/hooks',
'issue_events_url': 'https://api.github.com/repos/greenbone/asset-management-backend/issues/events{/number}',
'events_url': 'https://api.github.com/repos/greenbone/asset-management-backend/events',
'assignees_url': 'https://api.github.com/repos/greenbone/asset-management-backend/assignees{/user}',
'branches_url': 'https://api.github.com/repos/greenbone/asset-management-backend/branches{/branch}',
'tags_url': 'https://api.github.com/repos/greenbone/asset-management-backend/tags', 'blobs_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/blobs{/sha}', 'git_tags_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/tags{/sha}', 'git_refs_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/refs{/sha}', 'trees_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/trees{/sha}', 'statuses_url': 'https://api.github.com/repos/greenbone/asset-management-backend/statuses/{sha}', 'languages_url': 'https://api.github.com/repos/greenbone/asset-management-backend/languages', 'stargazers_url': 'https://api.github.com/repos/greenbone/asset-management-backend/stargazers', 'contributors_url': 'https://api.github.com/repos/greenbone/asset-management-backend/contributors',
'subscribers_url': 'https://api.github.com/repos/greenbone/asset-management-backend/subscribers', 'subscription_url': 'https://api.github.com/repos/greenbone/asset-management-backend/subscription', 'commits_url': 'https://api.github.com/repos/greenbone/asset-management-backend/commits{/sha}',
'git_commits_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/commits{/sha}', 'comments_url': 'https://api.github.com/repos/greenbone/asset-management-backend/comments{/number}', 'issue_comment_url': 'https://api.github.com/repos/greenbone/asset-management-backend/issues/comments{/number}',
'contents_url': 'https://api.github.com/repos/greenbone/asset-management-backend/contents/{+path}', 'compare_url': 'https://api.github.com/repos/greenbone/asset-management-backend/compare/{base}...{head}', 'merges_url': 'https://api.github.com/repos/greenbone/asset-management-backend/merges', 'archive_url': 'https://api.github.com/repos/greenbone/asset-management-backend/{archive_format}{/ref}',
'downloads_url': 'https://api.github.com/repos/greenbone/asset-management-backend/downloads', 'issues_url': 'https://api.github.com/repos/greenbone/asset-management-backend/issues{/number}', 'pulls_url': 'https://api.github.com/repos/greenbone/asset-management-backend/pulls{/number}', 'milestones_url': 'https://api.github.com/repos/greenbone/asset-management-backend/milestones{/number}',
'notifications_url': 'https://api.github.com/repos/greenbone/asset-management-backend/notifications{?since,all,participating}', 'labels_url': 'https://api.github.com/repos/greenbone/asset-management-backend/labels{/name}', 'releases_url': 'https://api.github.com/repos/greenbone/asset-management-backend/releases{/id}',
'deployments_url': 'https://api.github.com/repos/greenbone/asset-management-backend/deployments'
},
'html_url': 'https://github.com/orgs/greenbone/packages/container/package/asset-management-backend'
}
Loading
Loading