dds-cli 2.8.1__tar.gz → 2.10.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dds_cli-2.8.1 → dds_cli-2.10.0}/PKG-INFO +16 -7
- {dds_cli-2.8.1 → dds_cli-2.10.0}/README.md +4 -4
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/base.py +2 -1
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/data_remover.py +6 -2
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/version.py +1 -1
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli.egg-info/PKG-INFO +16 -7
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli.egg-info/requires.txt +1 -1
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_data_remover.py +43 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/LICENSE +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/__init__.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/__main__.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/account_manager.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/auth.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/custom_decorators.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/data_getter.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/data_lister.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/data_putter.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/directory.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/exceptions.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/file_compressor.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/file_encryptor.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/file_handler.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/file_handler_local.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/file_handler_remote.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/motd_manager.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/options.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/project_creator.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/project_info.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/project_status.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/s3_connector.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/status.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/superadmin_helper.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/text_handler.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/timestamp.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/unit_manager.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/user.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli/utils.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli.egg-info/SOURCES.txt +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli.egg-info/dependency_links.txt +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli.egg-info/entry_points.txt +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli.egg-info/not-zip-safe +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/dds_cli.egg-info/top_level.txt +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/pyproject.toml +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/setup.cfg +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/setup.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/__init__.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_account_manager.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_file_compressor.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_file_encryptor.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_file_handler_local.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_motd_manager.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_project_status.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_superadmin_helper.py +0 -0
- {dds_cli-2.8.1 → dds_cli-2.10.0}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dds_cli
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.10.0
|
|
4
4
|
Summary: A command line tool to manage data and projects in the SciLifeLab Data Delivery System.
|
|
5
5
|
Home-page: https://github.com/ScilifelabDataCentre/dds_cli
|
|
6
6
|
Author: SciLifeLab Data Centre
|
|
@@ -32,7 +32,16 @@ Requires-Dist: rich==13.6.0
|
|
|
32
32
|
Requires-Dist: rich-click==1.5.2
|
|
33
33
|
Requires-Dist: simplejson==3.17.6
|
|
34
34
|
Requires-Dist: tzlocal==4.2
|
|
35
|
-
Requires-Dist: zstandard==0.
|
|
35
|
+
Requires-Dist: zstandard==0.23.0
|
|
36
|
+
Dynamic: author
|
|
37
|
+
Dynamic: classifier
|
|
38
|
+
Dynamic: description
|
|
39
|
+
Dynamic: description-content-type
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: license
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
Dynamic: requires-dist
|
|
44
|
+
Dynamic: summary
|
|
36
45
|
|
|
37
46
|
<p>
|
|
38
47
|
<h1 align="center">Data Delivery System: CLI</h1>
|
|
@@ -59,12 +68,12 @@ Requires-Dist: zstandard==0.22.0
|
|
|
59
68
|
</a>
|
|
60
69
|
<br />
|
|
61
70
|
<a href="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/lint-black-cli.yml">
|
|
62
|
-
<img alt="
|
|
71
|
+
<img alt="Formatter: black" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/lint-black-cli.yml/badge.svg?event=push">
|
|
63
72
|
</a>
|
|
64
73
|
<img alt="CodeQL" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/codeql-cli.yml/badge.svg">
|
|
65
|
-
<a href="https://codecov.io/
|
|
66
|
-
|
|
67
|
-
</a>
|
|
74
|
+
<a href="https://codecov.io/github/ScilifelabDataCentre/dds_cli" >
|
|
75
|
+
<img src="https://codecov.io/github/ScilifelabDataCentre/dds_cli/graph/badge.svg?token=zsrDpNqs6v"/>
|
|
76
|
+
</a>
|
|
68
77
|
<img alt="Tests" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/pytest-cli.yml/badge.svg">
|
|
69
78
|
</p>
|
|
70
79
|
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
</a>
|
|
24
24
|
<br />
|
|
25
25
|
<a href="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/lint-black-cli.yml">
|
|
26
|
-
<img alt="
|
|
26
|
+
<img alt="Formatter: black" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/lint-black-cli.yml/badge.svg?event=push">
|
|
27
27
|
</a>
|
|
28
28
|
<img alt="CodeQL" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/codeql-cli.yml/badge.svg">
|
|
29
|
-
<a href="https://codecov.io/
|
|
30
|
-
|
|
31
|
-
</a>
|
|
29
|
+
<a href="https://codecov.io/github/ScilifelabDataCentre/dds_cli" >
|
|
30
|
+
<img src="https://codecov.io/github/ScilifelabDataCentre/dds_cli/graph/badge.svg?token=zsrDpNqs6v"/>
|
|
31
|
+
</a>
|
|
32
32
|
<img alt="Tests" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/pytest-cli.yml/badge.svg">
|
|
33
33
|
</p>
|
|
34
34
|
|
|
@@ -72,7 +72,8 @@ class DDSBaseClass:
|
|
|
72
72
|
# Use user defined destination if any specified
|
|
73
73
|
if self.method in DDS_DIR_REQUIRED_METHODS:
|
|
74
74
|
default_dir = pathlib.Path(
|
|
75
|
-
f"DataDelivery_{dds_cli.timestamp.TimeStamp().timestamp}_{self.project}"
|
|
75
|
+
f"DataDelivery_{dds_cli.timestamp.TimeStamp().timestamp}_{self.project}_"
|
|
76
|
+
f"{'upload' if self.method == 'put' else 'download'}"
|
|
76
77
|
)
|
|
77
78
|
if mount_dir:
|
|
78
79
|
new_directory = mount_dir / default_dir
|
|
@@ -39,6 +39,7 @@ class DataRemover(base.DDSBaseClass):
|
|
|
39
39
|
self,
|
|
40
40
|
project: str,
|
|
41
41
|
method: str = "rm",
|
|
42
|
+
authenticate: bool = True,
|
|
42
43
|
no_prompt: bool = False,
|
|
43
44
|
token_path: str = None,
|
|
44
45
|
):
|
|
@@ -47,6 +48,7 @@ class DataRemover(base.DDSBaseClass):
|
|
|
47
48
|
super().__init__(
|
|
48
49
|
project=project,
|
|
49
50
|
method=method,
|
|
51
|
+
authenticate=authenticate,
|
|
50
52
|
no_prompt=no_prompt,
|
|
51
53
|
token_path=token_path,
|
|
52
54
|
)
|
|
@@ -115,7 +117,6 @@ class DataRemover(base.DDSBaseClass):
|
|
|
115
117
|
LOG.warning("File deletion may have failed. Usage of space may increase.")
|
|
116
118
|
|
|
117
119
|
# Public methods ###################### Public methods #
|
|
118
|
-
@removal_spinner
|
|
119
120
|
def remove_all(self, *_, **__):
|
|
120
121
|
"""Remove all files in project."""
|
|
121
122
|
# Perform request to API to perform deletion
|
|
@@ -128,12 +129,15 @@ class DataRemover(base.DDSBaseClass):
|
|
|
128
129
|
)
|
|
129
130
|
|
|
130
131
|
# Print out response - deleted or not?
|
|
131
|
-
|
|
132
|
+
queue_message: str = response_json.get("message")
|
|
133
|
+
if "removed" not in response_json or "message" not in response_json:
|
|
132
134
|
raise dds_cli.exceptions.APIError(
|
|
133
135
|
"Malformatted response detected when attempting "
|
|
134
136
|
f"to remove all files from {self.project}."
|
|
135
137
|
)
|
|
136
138
|
|
|
139
|
+
dds_cli.utils.console.print("\n" + queue_message)
|
|
140
|
+
|
|
137
141
|
@removal_spinner
|
|
138
142
|
def remove_file(self, files):
|
|
139
143
|
"""Remove specific files."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dds_cli
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.10.0
|
|
4
4
|
Summary: A command line tool to manage data and projects in the SciLifeLab Data Delivery System.
|
|
5
5
|
Home-page: https://github.com/ScilifelabDataCentre/dds_cli
|
|
6
6
|
Author: SciLifeLab Data Centre
|
|
@@ -32,7 +32,16 @@ Requires-Dist: rich==13.6.0
|
|
|
32
32
|
Requires-Dist: rich-click==1.5.2
|
|
33
33
|
Requires-Dist: simplejson==3.17.6
|
|
34
34
|
Requires-Dist: tzlocal==4.2
|
|
35
|
-
Requires-Dist: zstandard==0.
|
|
35
|
+
Requires-Dist: zstandard==0.23.0
|
|
36
|
+
Dynamic: author
|
|
37
|
+
Dynamic: classifier
|
|
38
|
+
Dynamic: description
|
|
39
|
+
Dynamic: description-content-type
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: license
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
Dynamic: requires-dist
|
|
44
|
+
Dynamic: summary
|
|
36
45
|
|
|
37
46
|
<p>
|
|
38
47
|
<h1 align="center">Data Delivery System: CLI</h1>
|
|
@@ -59,12 +68,12 @@ Requires-Dist: zstandard==0.22.0
|
|
|
59
68
|
</a>
|
|
60
69
|
<br />
|
|
61
70
|
<a href="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/lint-black-cli.yml">
|
|
62
|
-
<img alt="
|
|
71
|
+
<img alt="Formatter: black" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/lint-black-cli.yml/badge.svg?event=push">
|
|
63
72
|
</a>
|
|
64
73
|
<img alt="CodeQL" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/codeql-cli.yml/badge.svg">
|
|
65
|
-
<a href="https://codecov.io/
|
|
66
|
-
|
|
67
|
-
</a>
|
|
74
|
+
<a href="https://codecov.io/github/ScilifelabDataCentre/dds_cli" >
|
|
75
|
+
<img src="https://codecov.io/github/ScilifelabDataCentre/dds_cli/graph/badge.svg?token=zsrDpNqs6v"/>
|
|
76
|
+
</a>
|
|
68
77
|
<img alt="Tests" src="https://github.com/ScilifelabDataCentre/dds_cli/actions/workflows/pytest-cli.yml/badge.svg">
|
|
69
78
|
</p>
|
|
70
79
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
from _pytest.logging import LogCaptureFixture
|
|
2
2
|
from pyfakefs.fake_filesystem import FakeFilesystem
|
|
3
|
+
from requests_mock.mocker import Mocker
|
|
4
|
+
import pytest
|
|
3
5
|
import pathlib
|
|
4
6
|
import logging
|
|
5
7
|
|
|
6
8
|
from dds_cli import data_remover
|
|
9
|
+
from dds_cli import DDSEndpoint
|
|
10
|
+
from dds_cli.exceptions import APIError
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
def test_delete_tempfile_cannot_delete(fs: FakeFilesystem, caplog: LogCaptureFixture):
|
|
@@ -51,3 +55,42 @@ def test_delete_tempfile_ok(fs: FakeFilesystem, caplog: LogCaptureFixture):
|
|
|
51
55
|
logging.WARNING,
|
|
52
56
|
"File deletion may have failed. Usage of space may increase.",
|
|
53
57
|
) not in caplog.record_tuples
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_delete_all_ok(capfd: LogCaptureFixture):
|
|
61
|
+
"""Delete all files. - ok"""
|
|
62
|
+
|
|
63
|
+
# Create mocker
|
|
64
|
+
with Mocker() as mock:
|
|
65
|
+
# Create mocked request - real request not executed
|
|
66
|
+
mock.delete(
|
|
67
|
+
DDSEndpoint.REMOVE_PROJ_CONT,
|
|
68
|
+
status_code=200,
|
|
69
|
+
json={"message": "All files removed.", "removed": True},
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
with data_remover.DataRemover(authenticate=False, project="project_1") as dr:
|
|
73
|
+
dr.token = {"Authorization": "Bearer FAKE_TOKEN"} # required
|
|
74
|
+
dr.remove_all()
|
|
75
|
+
|
|
76
|
+
out, err = capfd.readouterr()
|
|
77
|
+
assert "All files removed." in out
|
|
78
|
+
assert not err
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_delete_all_malformated_response():
|
|
82
|
+
"""Malformated response"""
|
|
83
|
+
|
|
84
|
+
# Create mocker
|
|
85
|
+
with Mocker() as mock:
|
|
86
|
+
# Create mocked request - real request not executed
|
|
87
|
+
mock.delete(DDSEndpoint.REMOVE_PROJ_CONT, status_code=200, json={})
|
|
88
|
+
|
|
89
|
+
with data_remover.DataRemover(authenticate=False, project="project_1") as dr:
|
|
90
|
+
dr.token = {"Authorization": "Bearer FAKE_TOKEN"} # required
|
|
91
|
+
|
|
92
|
+
with pytest.raises(APIError) as err:
|
|
93
|
+
dr.remove_all()
|
|
94
|
+
assert "Malformatted response detected when attempting to remove all files" in str(
|
|
95
|
+
err.value
|
|
96
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|