diff --git a/doc/release/release_notes.rst b/doc/release/release_notes.rst index bd40fe86..32538cac 100644 --- a/doc/release/release_notes.rst +++ b/doc/release/release_notes.rst @@ -6,6 +6,20 @@ Release Notes .. release:: Upcoming + .. change:: changed + + Updated name of the dump file generated by :option:`wiz --record` to + make it attachable to a Github issue and Jira ticket. The file extension + is now :file:`.gz` instead of :file:`.dump`, and invalid characters + have been removed. + + .. seealso:: + + * `Github - File attachments on issues and pull requests + `_ + * `JIRA - Attaching files and screenshots to issues + `_ + .. change:: fixed Fixed :meth:`wiz.graph.Graph.find` to prevent returning nodes with diff --git a/source/wiz/command_line.py b/source/wiz/command_line.py index 564706da..cc75a0b8 100644 --- a/source/wiz/command_line.py +++ b/source/wiz/command_line.py @@ -1962,7 +1962,9 @@ def _export_history_if_requested(click_context): history = wiz.history.get(serialized=True) path = os.path.join( os.path.abspath(click_context.obj["recording_path"]), - "wiz-{}.dump".format(datetime.datetime.now().isoformat()) + "wiz-{}.gz".format( + datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S-%f") + ) ) wiz.filesystem.export(path, history, compressed=True) logger.info("History recorded and exported in '{}'".format(path)) diff --git a/test/unit/test_command_line.py b/test/unit/test_command_line.py index bed7781a..c2ba91ac 100644 --- a/test/unit/test_command_line.py +++ b/test/unit/test_command_line.py @@ -34,10 +34,10 @@ def reset_configuration(mocker): @pytest.fixture() def mock_datetime_now(mocker): - """Return mocked 'wiz.fetch_definition_mapping' function.""" - _date = mocker.Mock(**{"isoformat.return_value": "NOW"}) + """Return mocked 'datetime.datetime.now' function.""" + value = datetime.datetime(2020, 8, 24, 17, 49, 1, 985944) return mocker.patch.object( - datetime, "datetime", **{"now.return_value": _date} + datetime, "datetime", **{"now.return_value": value} ) @@ -573,7 +573,8 @@ def test_list_packages_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True ) @@ -740,7 +741,8 @@ def test_list_commands_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True ) @@ -903,7 +905,8 @@ def test_search_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True ) @@ -1282,7 +1285,8 @@ def test_view_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True ) @@ -1487,7 +1491,8 @@ def test_use_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True ) @@ -1834,7 +1839,8 @@ def test_run_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True ) @@ -2151,7 +2157,8 @@ def test_freeze_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True ) @@ -2521,7 +2528,8 @@ def test_install_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True ) @@ -2793,7 +2801,8 @@ def test_edit_recorded( ) mocked_history_get.assert_called_once_with(serialized=True) mocked_filesystem_export.assert_called_once_with( - tempfile.gettempdir() + "/wiz-NOW.dump", "__HISTORY__", + tempfile.gettempdir() + "/wiz-2020-08-24-17-49-01-985944.gz", + "__HISTORY__", compressed=True )