dds-cli 2.8.0__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.8.0 → dds_cli-2.8.1}/PKG-INFO +1 -1
  2. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/__main__.py +9 -2
  3. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/motd_manager.py +2 -2
  4. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/version.py +1 -1
  5. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/PKG-INFO +1 -1
  6. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_motd_manager.py +27 -0
  7. {dds_cli-2.8.0 → dds_cli-2.8.1}/LICENSE +0 -0
  8. {dds_cli-2.8.0 → dds_cli-2.8.1}/README.md +0 -0
  9. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/__init__.py +0 -0
  10. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/account_manager.py +0 -0
  11. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/auth.py +0 -0
  12. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/base.py +0 -0
  13. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/custom_decorators.py +0 -0
  14. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/data_getter.py +0 -0
  15. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/data_lister.py +0 -0
  16. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/data_putter.py +0 -0
  17. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/data_remover.py +0 -0
  18. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/directory.py +0 -0
  19. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/exceptions.py +0 -0
  20. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_compressor.py +0 -0
  21. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_encryptor.py +0 -0
  22. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_handler.py +0 -0
  23. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_handler_local.py +0 -0
  24. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/file_handler_remote.py +0 -0
  25. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/options.py +0 -0
  26. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/project_creator.py +0 -0
  27. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/project_info.py +0 -0
  28. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/project_status.py +0 -0
  29. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/s3_connector.py +0 -0
  30. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/status.py +0 -0
  31. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/superadmin_helper.py +0 -0
  32. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/text_handler.py +0 -0
  33. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/timestamp.py +0 -0
  34. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/unit_manager.py +0 -0
  35. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/user.py +0 -0
  36. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli/utils.py +0 -0
  37. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/SOURCES.txt +0 -0
  38. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/dependency_links.txt +0 -0
  39. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/entry_points.txt +0 -0
  40. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/not-zip-safe +0 -0
  41. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/requires.txt +0 -0
  42. {dds_cli-2.8.0 → dds_cli-2.8.1}/dds_cli.egg-info/top_level.txt +0 -0
  43. {dds_cli-2.8.0 → dds_cli-2.8.1}/pyproject.toml +0 -0
  44. {dds_cli-2.8.0 → dds_cli-2.8.1}/setup.cfg +0 -0
  45. {dds_cli-2.8.0 → dds_cli-2.8.1}/setup.py +0 -0
  46. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/__init__.py +0 -0
  47. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_account_manager.py +0 -0
  48. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_data_remover.py +0 -0
  49. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_file_compressor.py +0 -0
  50. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_file_encryptor.py +0 -0
  51. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_file_handler_local.py +0 -0
  52. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_project_status.py +0 -0
  53. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_superadmin_helper.py +0 -0
  54. {dds_cli-2.8.0 → dds_cli-2.8.1}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dds_cli
3
- Version: 2.8.0
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
@@ -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.8.0"
5
+ __version__ = "2.8.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dds_cli
3
- Version: 2.8.0
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
@@ -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
File without changes
File without changes