def test_save(self, _format, mocker):
     mocky = mocker.patch.object(BookmarksConverter, "_dispatcher")
     method = f"_save_to_{_format}"
     instance = BookmarksConverter("filepath")
     instance._export = _format
     instance._format = _format
     instance.save()
     mocky.assert_called_once_with(method)
 def test_dispatcher(self, _format, method, mocker):
     lower_format = _format.lower()
     mocky = mocker.patch.object(BookmarksConverter, method)
     instance = BookmarksConverter("filepath")
     instance._export = lower_format
     instance._format = lower_format
     instance._dispatcher(method)
     mocky.assert_called_once()
 def test_save_to_html(self, result_bookmark_files):
     result_file = result_bookmark_files["from_firefox_json.html"]
     instance = BookmarksConverter(result_file)
     with open(result_file, "r", encoding="utf-8") as file_:
         instance.bookmarks = file_.read()
     output_file = Path(result_file).with_name("output_file.html")
     instance.output_filepath = output_file
     # setting the _export and _format attributes manually.
     instance._export = "html"
     instance._format = "html"
     instance.save()
     assert cmp(result_file, output_file, shallow=False)
     output_file.unlink()