| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 47a5606 commit 4518046
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,6 +89,13 @@ List package files for package in project:: | |||
| 89 | 89 | package = project.packages.get(1) | |
| 90 | 90 | package_files = package.package_files.list() | |
| 91 | 91 | ||
| 92 | + Delete a package file in a project:: | ||
| 93 | + | ||
| 94 | + package = project.packages.get(1) | ||
| 95 | + file = package.package_files.list()[0] | ||
| 96 | + package.package_files.delete(file.id) | ||
| 97 | + | ||
| 98 | + | ||
| 92 | 99 | Generic Packages | |
| 93 | 100 | ================ | |
| 94 | 101 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -162,7 +162,7 @@ class ProjectPackageFile(RESTObject): | |||
| 162 | 162 | pass | |
| 163 | 163 | ||
| 164 | 164 | ||
| 165 | - class ProjectPackageFileManager(ListMixin, RESTManager): | ||
| 165 | + class ProjectPackageFileManager(DeleteMixin, ListMixin, RESTManager): | ||
| 166 | 166 | _path = "/projects/%(project_id)s/packages/%(package_id)s/package_files" | |
| 167 | 167 | _obj_cls = ProjectPackageFile | |
| 168 | 168 | _from_parent_attrs = {"project_id": "project_id", "package_id": "id"} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,6 +155,19 @@ def resp_delete_package(no_content): | |||
| 155 | 155 | yield rsps | |
| 156 | 156 | ||
| 157 | 157 | ||
| 158 | + @pytest.fixture | ||
| 159 | + def resp_delete_package_file(no_content): | ||
| 160 | + with responses.RequestsMock() as rsps: | ||
| 161 | + rsps.add( | ||
| 162 | + method=responses.DELETE, | ||
| 163 | + url="http://localhost/api/v4/projects/1/packages/1/package_files/1", | ||
| 164 | + json=no_content, | ||
| 165 | + content_type="application/json", | ||
| 166 | + status=204, | ||
| 167 | + ) | ||
| 168 | + yield rsps | ||
| 169 | + | ||
| 170 | + | ||
| 158 | 171 | @pytest.fixture | |
| 159 | 172 | def resp_list_package_files(): | |
| 160 | 173 | with responses.RequestsMock() as rsps: | |
@@ -229,6 +242,11 @@ def test_list_project_package_files(project, resp_list_package_files): | |||
| 229 | 242 | assert package_files[0].id == 25 | |
| 230 | 243 | ||
| 231 | 244 | ||
| 245 | + def test_delete_project_package_file(project, resp_delete_package_file): | ||
| 246 | + package = project.packages.get(1, lazy=True) | ||
| 247 | + package.package_files.delete(1) | ||
| 248 | + | ||
| 249 | + | ||
| 232 | 250 | def test_upload_generic_package(tmp_path, project, resp_upload_generic_package): | |
| 233 | 251 | path = tmp_path / file_name | |
| 234 | 252 | path.write_text(file_content) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments