From 6d839d5cc71cbb8f839fb95365f838d8fd01f94c Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Tue, 4 Jan 2022 21:12:59 +0100 Subject: [PATCH] Bugfixes from testrun --- cps/editbooks.py | 11 +- cps/static/js/main.js | 5 +- test/Calibre-Web TestSummary_Linux.html | 1023 ++++++++++------------- 3 files changed, 455 insertions(+), 584 deletions(-) mode change 100644 => 100755 cps/editbooks.py mode change 100644 => 100755 cps/static/js/main.js diff --git a/cps/editbooks.py b/cps/editbooks.py old mode 100644 new mode 100755 index b6fdc164..e20cfcfb --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -357,7 +357,16 @@ def delete_book_from_table(book_id, book_format, jsonResponse): else: # book not found log.error('Book with id "%s" could not be deleted: not found', book_id) - return render_delete_book_result(book_format, jsonResponse, warning, book_id) + return render_delete_book_result(book_format, jsonResponse, warning, book_id) + message = _("You are missing permissions to delete books") + if jsonResponse: + return json.dumps({"location": url_for("editbook.edit_book", book_id=book_id), + "type": "danger", + "format": "", + "message": message}) + else: + flash(message, category="error") + return redirect(url_for('editbook.edit_book', book_id=book_id)) def render_edit_book(book_id): diff --git a/cps/static/js/main.js b/cps/static/js/main.js old mode 100644 new mode 100755 index e8da76ef..cf5a4327 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -198,7 +198,7 @@ function confirmDialog(id, dialogid, dataValue, yesFn, noFn) { $confirm.modal('show'); } -$("#delete_confirm").click(function() { +$("#delete_confirm").click(function(event) { //get data-id attribute of the clicked element var deleteId = $(this).data("delete-id"); var bookFormat = $(this).data("delete-format"); @@ -228,8 +228,7 @@ $("#delete_confirm").click(function() { } }); } else { - window.location.href = getPath() + "/delete/" + deleteId; - + postButton(event, getPath() + "/delete/" + deleteId); } } diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index d291d368..511300be 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2021-12-22 20:24:40

+

Start Time: 2022-01-02 17:11:15

-

Stop Time: 2021-12-23 00:00:41

+

Stop Time: 2022-01-02 21:33:59

-

Duration: 2h 57 min

+

Duration: 3h 43 min

@@ -411,21 +411,50 @@ - + TestEbookConvertCalibre + 15 14 - 14 - 0 + 1 0 0 - Detail + Detail - + + +
TestEbookConvertCalibre - test_calibre_log
+ + +
+ FAIL +
+ + + + + + + + +
TestEbookConvertCalibre - test_convert_deactivate
@@ -434,7 +463,7 @@ - +
TestEbookConvertCalibre - test_convert_email
@@ -443,7 +472,7 @@ - +
TestEbookConvertCalibre - test_convert_failed_and_email
@@ -452,7 +481,7 @@ - +
TestEbookConvertCalibre - test_convert_only
@@ -461,7 +490,7 @@ - +
TestEbookConvertCalibre - test_convert_options
@@ -470,7 +499,7 @@ - +
TestEbookConvertCalibre - test_convert_parameter
@@ -479,7 +508,7 @@ - +
TestEbookConvertCalibre - test_convert_wrong_excecutable
@@ -488,7 +517,7 @@ - +
TestEbookConvertCalibre - test_convert_xss
@@ -497,7 +526,7 @@ - +
TestEbookConvertCalibre - test_email_failed
@@ -506,7 +535,7 @@ - +
TestEbookConvertCalibre - test_email_only
@@ -515,7 +544,7 @@ - +
TestEbookConvertCalibre - test_kindle_send_not_configured
@@ -524,7 +553,7 @@ - +
TestEbookConvertCalibre - test_ssl_smtp_setup_error
@@ -533,7 +562,7 @@ - +
TestEbookConvertCalibre - test_starttls_smtp_setup_error
@@ -542,7 +571,7 @@ - +
TestEbookConvertCalibre - test_user_convert_xss
@@ -782,11 +811,31 @@ - +
TestEditAdditionalBooks - test_title_sort
- PASS + +
+ FAIL +
+ + + + @@ -844,31 +893,11 @@ - +
TestEditAdditionalBooks - test_writeonly_path
- -
- FAIL -
- - - - + PASS @@ -901,11 +930,11 @@ AssertionError: False is not true - + TestEditBooks 35 - 32 - 2 + 34 + 0 0 1 @@ -924,31 +953,11 @@ AssertionError: False is not true - +
TestEditBooks - test_edit_author
- -
- FAIL -
- - - - + PASS @@ -1097,31 +1106,11 @@ AssertionError: False is not true - +
TestEditBooks - test_edit_title
- -
- FAIL -
- - - - + PASS @@ -1466,48 +1455,39 @@ AssertionError: False is not true - TestEditBooksOnGdrive - 20 - 18 - 2 + TestEditMetadata + 1 + 0 + 1 0 0 - Detail + Detail - - -
TestEditBooksOnGdrive - test_download_book
- - PASS - - - - - + -
TestEditBooksOnGdrive - test_edit_author
+
TestEditMetadata - test_upload_book_lit
- FAIL + FAIL
-