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()
 def test_save_to_db(self, get_data_from_db):
     file_path = "temp.db"
     bookmarks = list()
     for i in range(1, 11):
         parent_id = None if i == 0 else 0
         bookmarks.append(
             Folder(date_added=0,
                    index=0,
                    _id=i,
                    parent_id=parent_id,
                    title="Title"))
     instance = BookmarksConverter(file_path)
     instance.bookmarks = bookmarks
     # setting the _export attribute as not to raise an error
     # setting the _format attribute for the desired output format
     instance._export = instance._format = "db"
     instance.save()
     output_file = instance.output_filepath
     temp_bookmarks, _, _ = get_data_from_db(output_file, None)
     assert bookmarks == temp_bookmarks
     output_file.unlink()