dds-cli 2.7.1__tar.gz → 2.8.1__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.
Files changed (54) hide show
  1. {dds_cli-2.7.1 → dds_cli-2.8.1}/PKG-INFO +9 -8
  2. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/__init__.py +3 -0
  3. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/__main__.py +10 -3
  4. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/motd_manager.py +2 -2
  5. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/version.py +1 -1
  6. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli.egg-info/PKG-INFO +9 -8
  7. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli.egg-info/requires.txt +6 -6
  8. {dds_cli-2.7.1 → dds_cli-2.8.1}/setup.py +2 -1
  9. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_motd_manager.py +27 -0
  10. {dds_cli-2.7.1 → dds_cli-2.8.1}/LICENSE +0 -0
  11. {dds_cli-2.7.1 → dds_cli-2.8.1}/README.md +0 -0
  12. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/account_manager.py +0 -0
  13. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/auth.py +0 -0
  14. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/base.py +0 -0
  15. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/custom_decorators.py +0 -0
  16. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/data_getter.py +0 -0
  17. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/data_lister.py +0 -0
  18. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/data_putter.py +0 -0
  19. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/data_remover.py +0 -0
  20. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/directory.py +0 -0
  21. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/exceptions.py +0 -0
  22. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/file_compressor.py +0 -0
  23. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/file_encryptor.py +0 -0
  24. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/file_handler.py +0 -0
  25. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/file_handler_local.py +0 -0
  26. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/file_handler_remote.py +0 -0
  27. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/options.py +0 -0
  28. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/project_creator.py +0 -0
  29. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/project_info.py +0 -0
  30. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/project_status.py +0 -0
  31. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/s3_connector.py +0 -0
  32. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/status.py +0 -0
  33. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/superadmin_helper.py +0 -0
  34. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/text_handler.py +0 -0
  35. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/timestamp.py +0 -0
  36. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/unit_manager.py +0 -0
  37. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/user.py +0 -0
  38. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli/utils.py +0 -0
  39. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli.egg-info/SOURCES.txt +0 -0
  40. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli.egg-info/dependency_links.txt +0 -0
  41. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli.egg-info/entry_points.txt +0 -0
  42. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli.egg-info/not-zip-safe +0 -0
  43. {dds_cli-2.7.1 → dds_cli-2.8.1}/dds_cli.egg-info/top_level.txt +0 -0
  44. {dds_cli-2.7.1 → dds_cli-2.8.1}/pyproject.toml +0 -0
  45. {dds_cli-2.7.1 → dds_cli-2.8.1}/setup.cfg +0 -0
  46. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/__init__.py +0 -0
  47. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_account_manager.py +0 -0
  48. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_data_remover.py +0 -0
  49. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_file_compressor.py +0 -0
  50. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_file_encryptor.py +0 -0
  51. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_file_handler_local.py +0 -0
  52. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_project_status.py +0 -0
  53. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_superadmin_helper.py +0 -0
  54. {dds_cli-2.7.1 → dds_cli-2.8.1}/tests/test_utils.py +0 -0
@@ -1,16 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dds_cli
3
- Version: 2.7.1
3
+ Version: 2.8.1
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
7
7
  License: MIT
8
8
  Classifier: Development Status :: 4 - Beta
9
9
  Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3.7
11
10
  Classifier: Programming Language :: Python :: 3.8
12
11
  Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
14
15
  Description-Content-Type: text/markdown
15
16
  License-File: LICENSE
16
17
  Requires-Dist: boto3==1.24.73
@@ -20,18 +21,18 @@ Requires-Dist: click-pathlib==2020.3.13.0
20
21
  Requires-Dist: cryptography==42.0.4
21
22
  Requires-Dist: immutabledict==2.2.1
22
23
  Requires-Dist: jwcrypto==1.5.6
23
- Requires-Dist: prettytable==3.4.1
24
- Requires-Dist: prompt-toolkit==3.0.31
24
+ Requires-Dist: prettytable==3.7.0
25
+ Requires-Dist: prompt-toolkit==3.0.40
25
26
  Requires-Dist: PyNaCl==1.5.0
26
27
  Requires-Dist: pytz==2022.2.1
27
- Requires-Dist: PyYAML==6.0.1
28
+ Requires-Dist: PyYAML==6.0.2
28
29
  Requires-Dist: questionary==1.10.0
29
- Requires-Dist: requests==2.32.0
30
- Requires-Dist: rich==12.5.1
30
+ Requires-Dist: requests==2.32.2
31
+ Requires-Dist: rich==13.6.0
31
32
  Requires-Dist: rich-click==1.5.2
32
33
  Requires-Dist: simplejson==3.17.6
33
34
  Requires-Dist: tzlocal==4.2
34
- Requires-Dist: zstandard==0.19.0
35
+ Requires-Dist: zstandard==0.22.0
35
36
 
36
37
  <p>
37
38
  <h1 align="center">Data Delivery System: CLI</h1>
@@ -61,12 +61,15 @@ class DDSEndpoint:
61
61
  BASE_ENDPOINT_DOCKER = "http://dds_backend:5000/api/v1"
62
62
  BASE_ENDPOINT_REMOTE = "https://delivery.scilifelab.se/api/v1"
63
63
  BASE_ENDPOINT_REMOTE_TEST = "https://testing.delivery.scilifelab.se/api/v1"
64
+ BASE_ENDPOINT_REMOTE_DEV = "https://dev.delivery.scilifelab.se/api/v1"
64
65
  if os.getenv("DDS_CLI_ENV") == "development":
65
66
  BASE_ENDPOINT = BASE_ENDPOINT_LOCAL
66
67
  elif os.getenv("DDS_CLI_ENV") == "docker-dev":
67
68
  BASE_ENDPOINT = BASE_ENDPOINT_DOCKER
68
69
  elif os.getenv("DDS_CLI_ENV") == "test-instance":
69
70
  BASE_ENDPOINT = BASE_ENDPOINT_REMOTE_TEST
71
+ elif os.getenv("DDS_CLI_ENV") == "dev-instance":
72
+ BASE_ENDPOINT = BASE_ENDPOINT_REMOTE_DEV
70
73
  else:
71
74
  BASE_ENDPOINT = BASE_ENDPOINT_REMOTE
72
75
 
@@ -1185,7 +1185,7 @@ def retract_project(click_ctx, project):
1185
1185
  required=False,
1186
1186
  is_flag=True,
1187
1187
  default=False,
1188
- help="Something has one wrong in the project.",
1188
+ help="Something has gone wrong in the project.",
1189
1189
  )
1190
1190
  @click.pass_obj
1191
1191
  def archive_project(click_ctx, project: str, abort: bool = False):
@@ -2070,15 +2070,22 @@ def deactivate_motd(click_ctx, motd_id):
2070
2070
  # -- dds motd send -- #
2071
2071
  @motd_group_command.command(name="send")
2072
2072
  @click.argument("motd_id", metavar="[MOTD_ID]", nargs=1, type=int, required=True)
2073
+ @click.option(
2074
+ "--unit-only",
2075
+ is_flag=True,
2076
+ required=False,
2077
+ default=False,
2078
+ help="Only send MOTD to Unit Admins and Unit Personnel.",
2079
+ )
2073
2080
  @click.pass_obj
2074
- def send_motd(click_ctx, motd_id):
2081
+ def send_motd(click_ctx, motd_id, unit_only):
2075
2082
  """Send motd as email to all users."""
2076
2083
  try:
2077
2084
  with dds_cli.motd_manager.MotdManager(
2078
2085
  no_prompt=click_ctx.get("NO_PROMPT", False),
2079
2086
  token_path=click_ctx.get("TOKEN_PATH"),
2080
2087
  ) as sender:
2081
- sender.send_motd(motd_id=motd_id)
2088
+ sender.send_motd(motd_id=motd_id, unit_only=unit_only)
2082
2089
  except (
2083
2090
  dds_cli.exceptions.AuthenticationError,
2084
2091
  dds_cli.exceptions.ApiResponseError,
@@ -126,13 +126,13 @@ class MotdManager(dds_cli.base.DDSBaseClass):
126
126
  )
127
127
  LOG.info(response_message)
128
128
 
129
- def send_motd(self, motd_id: int) -> None:
129
+ def send_motd(self, motd_id: int, unit_only=False) -> None:
130
130
  """Send specific MOTD to users."""
131
131
  response_json, _ = dds_cli.utils.perform_request(
132
132
  endpoint=DDSEndpoint.MOTD_SEND,
133
133
  headers=self.token,
134
134
  method="post",
135
- json={"motd_id": motd_id},
135
+ json={"motd_id": motd_id, "unit_only": unit_only},
136
136
  error_message="Failed sending the MOTD to users",
137
137
  )
138
138
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  # Do not change bump the major version unless absolutely necessary - makes incompatible with API
4
4
  # If mid or minor version reaches 9, continue to 10, 11 etc.
5
- __version__ = "2.7.1"
5
+ __version__ = "2.8.1"
@@ -1,16 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dds_cli
3
- Version: 2.7.1
3
+ Version: 2.8.1
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
7
7
  License: MIT
8
8
  Classifier: Development Status :: 4 - Beta
9
9
  Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3.7
11
10
  Classifier: Programming Language :: Python :: 3.8
12
11
  Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
14
15
  Description-Content-Type: text/markdown
15
16
  License-File: LICENSE
16
17
  Requires-Dist: boto3==1.24.73
@@ -20,18 +21,18 @@ Requires-Dist: click-pathlib==2020.3.13.0
20
21
  Requires-Dist: cryptography==42.0.4
21
22
  Requires-Dist: immutabledict==2.2.1
22
23
  Requires-Dist: jwcrypto==1.5.6
23
- Requires-Dist: prettytable==3.4.1
24
- Requires-Dist: prompt-toolkit==3.0.31
24
+ Requires-Dist: prettytable==3.7.0
25
+ Requires-Dist: prompt-toolkit==3.0.40
25
26
  Requires-Dist: PyNaCl==1.5.0
26
27
  Requires-Dist: pytz==2022.2.1
27
- Requires-Dist: PyYAML==6.0.1
28
+ Requires-Dist: PyYAML==6.0.2
28
29
  Requires-Dist: questionary==1.10.0
29
- Requires-Dist: requests==2.32.0
30
- Requires-Dist: rich==12.5.1
30
+ Requires-Dist: requests==2.32.2
31
+ Requires-Dist: rich==13.6.0
31
32
  Requires-Dist: rich-click==1.5.2
32
33
  Requires-Dist: simplejson==3.17.6
33
34
  Requires-Dist: tzlocal==4.2
34
- Requires-Dist: zstandard==0.19.0
35
+ Requires-Dist: zstandard==0.22.0
35
36
 
36
37
  <p>
37
38
  <h1 align="center">Data Delivery System: CLI</h1>
@@ -5,15 +5,15 @@ click-pathlib==2020.3.13.0
5
5
  cryptography==42.0.4
6
6
  immutabledict==2.2.1
7
7
  jwcrypto==1.5.6
8
- prettytable==3.4.1
9
- prompt-toolkit==3.0.31
8
+ prettytable==3.7.0
9
+ prompt-toolkit==3.0.40
10
10
  PyNaCl==1.5.0
11
11
  pytz==2022.2.1
12
- PyYAML==6.0.1
12
+ PyYAML==6.0.2
13
13
  questionary==1.10.0
14
- requests==2.32.0
15
- rich==12.5.1
14
+ requests==2.32.2
15
+ rich==13.6.0
16
16
  rich-click==1.5.2
17
17
  simplejson==3.17.6
18
18
  tzlocal==4.2
19
- zstandard==0.19.0
19
+ zstandard==0.22.0
@@ -24,10 +24,11 @@ setup(
24
24
  classifiers=[
25
25
  "Development Status :: 4 - Beta",
26
26
  "License :: OSI Approved :: MIT License",
27
- "Programming Language :: Python :: 3.7",
28
27
  "Programming Language :: Python :: 3.8",
29
28
  "Programming Language :: Python :: 3.9",
30
29
  "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
31
32
  ],
32
33
  url="https://github.com/ScilifelabDataCentre/dds_cli",
33
34
  author="SciLifeLab Data Centre",
@@ -222,3 +222,30 @@ def test_add_new_motd_ok(caplog: LogCaptureFixture):
222
222
  logging.INFO,
223
223
  "Response from API about adding a MOTD.",
224
224
  ) in caplog.record_tuples
225
+
226
+
227
+ # send_motd
228
+
229
+
230
+ def test_send_motd_all(caplog: LogCaptureFixture):
231
+ """Send a MOTD to all users."""
232
+
233
+ motd_id = 1
234
+ response_message = "Response from API about sending a MOTD."
235
+ returned_response: Dict = {"message": response_message}
236
+
237
+ with caplog.at_level(logging.INFO):
238
+ # Create mocker
239
+ with Mocker() as mock:
240
+ # Create mocked request - real request not executed
241
+ mock.post(DDSEndpoint.MOTD_SEND, status_code=200, json=returned_response)
242
+
243
+ with motd_manager.MotdManager(authenticate=False, no_prompt=True) as mtdm:
244
+ mtdm.token = {} # required, otherwise none
245
+ mtdm.send_motd(motd_id=motd_id, unit_only=False) # Send motd
246
+
247
+ assert (
248
+ "dds_cli.motd_manager",
249
+ logging.INFO,
250
+ response_message,
251
+ ) in caplog.record_tuples
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