diff --git a/.gitattributes b/.gitattributes index ff7c4955..a53b37de 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ helper.py ident export-subst +/test export-ignore cps/static/css/libs/* linguist-vendored cps/static/js/libs/* linguist-vendored diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 44c3619f..69e59aa5 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -60,7 +60,7 @@ {% endif %} -

{{entry.title|shortentitle(40)}}

+

{{entry.title|shortentitle(40)}}

{% for author in entry.authors %} {{author.name.replace('|',',')}} diff --git a/cps/web.py b/cps/web.py index 18f1f9e8..5d6e766c 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1752,6 +1752,8 @@ def authenticate_google_drive(): @app.route("/gdrive/callback") def google_drive_callback(): auth_code = request.args.get('code') + if not auth_code: + abort(403) try: credentials = gdriveutils.Gauth.Instance().auth.flow.step2_exchange(auth_code) with open(os.path.join(config.get_main_dir,'gdrive_credentials'), 'w') as f: @@ -3689,6 +3691,7 @@ def edit_book(book_id): if "detail_view" in to_save: return redirect(url_for('show_book', book_id=book.id)) else: + flash(_("Metadata successfully updated"), category="success") return render_edit_book(book_id) else: db.session.rollback() diff --git a/test/Calibre-Web TestSummary.html b/test/Calibre-Web TestSummary.html new file mode 100644 index 00000000..835f9110 --- /dev/null +++ b/test/Calibre-Web TestSummary.html @@ -0,0 +1,2481 @@ + + + + + + + Test Report + + + + + + + + + + + + + + + + + + + + +

+
+

Test Report

+
+ +
+
+

Start Time: 2018-10-03 13:01:23.133262

+ +
+
+

Stop Time: 2018-10-03 13:24:03.908667

+ +
+
+

Duration: 0:22:40.775405

+ +
+
+ +
+
+ +
+
+ +
+
All Calibre-Web tests
+
+ + +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Test Group/Test caseCountPassFailErrorSkipView
test_shelf.test_shelf76100 + Detail +
+
test_delete_book_of_shelf
+
PASS
+
test_private_shelf
+
PASS
+
test_public_private_shelf
+
PASS
+
test_public_shelf
+
PASS
+
test_rename_shelf
+
PASS
+
test_shelf_database_change
+
+
+ FAIL +
+ + + +
+
test_shelf_long_name
+
PASS
test_logging.test_logging43100 + Detail +
+
test_debug_log
+
PASS
+
test_failed_login
+
PASS
+
test_logfile_change
+
PASS
+
test_logfile_recover
+
+
+ FAIL +
+ + + +
test_helper.calibre_helper1111000 + Detail +
+
test_author_sort
+
PASS
+
test_author_sort_junior
+
PASS
+
test_author_sort_roman
+
PASS
+
test_check_Limit_Length
+
PASS
+
test_check_char_replacement
+
PASS
+
test_check_chinese_Characters
+
PASS
+
test_check_degEUR_replacement
+
PASS
+
test_check_doubleS
+
PASS
+
test_check_finish_Dot
+
PASS
+
test_check_high23
+
PASS
+
test_check_umlauts
+
PASS
test_visiblilitys.calibre_web_visibilitys1616000 + Detail +
+
test_about
+
PASS
+
test_admin_SMTP_Settings
+
PASS
+
test_admin_add_user
+
PASS
+
test_admin_change_password
+
PASS
+
test_admin_change_visibility_authors
+
+
+ PASS +
+ + + +
+
test_admin_change_visibility_category
+
PASS
+
test_admin_change_visibility_hot
+
PASS
+
test_admin_change_visibility_language
+
PASS
+
test_admin_change_visibility_rated
+
PASS
+
test_admin_change_visibility_read
+
PASS
+
test_admin_change_visibility_series
+
PASS
+
test_admin_change_visibility_sorted
+
PASS
+
test_checked_logged_in
+
PASS
+
test_random_books_available
+
PASS
+
test_user_email_available
+
PASS
+
test_user_visibility_sidebar
+
PASS
test_user_template.test_user_template1411003 + Detail +
+
test_author_user_template
+
+
+ PASS +
+ + + +
+
test_best_user_template
+
+
+ PASS +
+ + + +
+
test_category_user_template
+
+
+ PASS +
+ + + +
+
test_detail_random_user_template
+
+
+ PASS +
+ + + +
+
test_hot_user_template
+
+
+ PASS +
+ + + +
+
test_language_user_template
+
+
+ PASS +
+ + + +
+
test_limit_book_languages
+
+
+ SKIP +
+ + + +
+
test_mature_content_settings
+
+
+ SKIP +
+ + + +
+
test_random_user_template
+
+
+ PASS +
+ + + +
+
test_read_user_template
+
+
+ PASS +
+ + + +
+
test_recent_user_template
+
+
+ PASS +
+ + + +
+
test_series_user_template
+
+
+ PASS +
+ + + +
+
test_sorted_user_template
+
+
+ PASS +
+ + + +
+
test_ui_language_settings
+
+
+ SKIP +
+ + + +
test_anonymous.test_anonymous10001 + Detail +
+
test_anonymous_user
+
+
+ SKIP +
+ + + +
test_ebook_convert.test_ebook_convert120903 + Detail +
+
test_SSL_smtp_setup_error
+
+
+ FAIL +
+ + + +
+
test_STARTTLS_smtp_setup_error
+
+
+ FAIL +
+ + + +
+
test_convert_deactivate
+
+
+ SKIP +
+ + + +
+
test_convert_email
+
+
+ FAIL +
+ + + +
+
test_convert_failed_and_email
+
+
+ FAIL +
+ + + +
+
test_convert_only
+
+
+ FAIL +
+ + + +
+
test_convert_parameter
+
+
+ SKIP +
+ + + +
+
test_convert_wrong_excecutable
+
+
+ SKIP +
+ + + +
+
test_email_failed
+
+
+ FAIL +
+ + + +
+
test_email_only
+
+
+ FAIL +
+ + + +
+
test_kindle_send_not_configured
+
+
+ FAIL +
+ + + +
+
test_smtp_setup_error
+
+
+ FAIL +
+ + + +
test_edit_books.test_edit_books2220020 + Detail +
+
test_database_errors
+
+
+ SKIP +
+ + + +
+
test_delete_book
+
+
+ SKIP +
+ + + +
+
test_delete_format
+
+
+ SKIP +
+ + + +
+
test_edit_author
+
PASS
+
test_edit_category
+
+
+ SKIP +
+ + + +
+
test_edit_comments
+
+
+ SKIP +
+ + + +
+
test_edit_custom_bool
+
+
+ SKIP +
+ + + +
+
test_edit_custom_rating
+
+
+ SKIP +
+ + + +
+
test_edit_custom_single_select
+
+
+ SKIP +
+ + + +
+
test_edit_custom_text
+
+
+ SKIP +
+ + + +
+
test_edit_language
+
+
+ SKIP +
+ + + +
+
test_edit_publisher
+
+
+ SKIP +
+ + + +
+
test_edit_publishing_date
+
+
+ SKIP +
+ + + +
+
test_edit_rating
+
+
+ SKIP +
+ + + +
+
test_edit_series
+
+
+ SKIP +
+ + + +
+
test_edit_title
+
PASS
+
test_typeahead_author
+
+
+ SKIP +
+ + + +
+
test_typeahead_language
+
+
+ SKIP +
+ + + +
+
test_typeahead_publisher
+
+
+ SKIP +
+ + + +
+
test_typeahead_series
+
+
+ SKIP +
+ + + +
+
test_typeahead_tag
+
+
+ SKIP +
+ + + +
+
test_upload_cover_hdd
+
+
+ SKIP +
+ + + +
test_edit_books_gdrive.test_edit_books_gdrive2200022 + Detail +
+
test_database_errors
+
+
+ SKIP +
+ + + +
+
test_delete_book
+
+
+ SKIP +
+ + + +
+
test_delete_format
+
+
+ SKIP +
+ + + +
+
test_edit_author
+
+
+ SKIP +
+ + + +
+
test_edit_category
+
+
+ SKIP +
+ + + +
+
test_edit_comments
+
+
+ SKIP +
+ + + +
+
test_edit_custom_bool
+
+
+ SKIP +
+ + + +
+
test_edit_custom_rating
+
+
+ SKIP +
+ + + +
+
test_edit_custom_single_select
+
+
+ SKIP +
+ + + +
+
test_edit_custom_text
+
+
+ SKIP +
+ + + +
+
test_edit_language
+
+
+ SKIP +
+ + + +
+
test_edit_publisher
+
+
+ SKIP +
+ + + +
+
test_edit_publishing_date
+
+
+ SKIP +
+ + + +
+
test_edit_rating
+
+
+ SKIP +
+ + + +
+
test_edit_series
+
+
+ SKIP +
+ + + +
+
test_edit_title
+
+
+ SKIP +
+ + + +
+
test_typeahead_author
+
+
+ SKIP +
+ + + +
+
test_typeahead_language
+
+
+ SKIP +
+ + + +
+
test_typeahead_publisher
+
+
+ SKIP +
+ + + +
+
test_typeahead_series
+
+
+ SKIP +
+ + + +
+
test_typeahead_tag
+
+
+ SKIP +
+ + + +
+
test_upload_cover_hdd
+
+
+ SKIP +
+ + + +
test_login.test_login65100 + Detail +
+
test_login_capital_letters_user_unicode_password_passwort
+
PASS
+
test_login_delete_admin
+
+
+ FAIL +
+ + + +
+
test_login_empty_password
+
PASS
+
test_login_protected
+
PASS
+
test_login_unicode_user_space_end_passwort
+
PASS
+
test_login_user_with_space_passwort_end_space
+
PASS
test_opds_feed.test_opds_feed10001 + Detail +
+
test_opds
+
+
+ SKIP +
+ + + +
test_updater.test_updater10001 + Detail +
+
test_updater
+
+
+ SKIP +
+ + + +
test_register.test_register40004 + Detail +
+
test_login_with_password
+
+
+ SKIP +
+ + + +
+
test_registering_user
+
+
+ SKIP +
+ + + +
+
test_registering_user_fail
+
+
+ SKIP +
+ + + +
+
test_resend_password
+
+
+ SKIP +
+ + + +
test_cli.test_cli44000 + Detail +
+
test_cli_SSL_files
+
PASS
+
test_cli_different_folder
+
PASS
+
test_cli_different_settings_database
+
PASS
+
test_environ_port_setting
+
PASS
Total1255812055 
+ + + +
+ + + + + diff --git a/test/css/runner.css b/test/css/runner.css new file mode 100644 index 00000000..440f87ea --- /dev/null +++ b/test/css/runner.css @@ -0,0 +1,21 @@ +.hiddenRow { + display: none; +} + +.bg-grey { + background-color: rgba(0, 0, 0, 0.03); +} + +.table-curved { + border-radius: 20px; +} + +.buttons, .report-description { + margin: 5px; + padding: 5px; +} + +.piechart{ + text-align: center; +} + diff --git a/test/js/runner.js b/test/js/runner.js new file mode 100644 index 00000000..2ecf3652 --- /dev/null +++ b/test/js/runner.js @@ -0,0 +1,189 @@ +output_list = Array(); + +/* Level - 0: Summary; 1: Failed; 2: All; 3: Skipped */ +function showCase(level) { + table_rows = document.getElementsByTagName("tr"); + for (var i = 0; i < table_rows.length; i++) { + row = table_rows[i]; + id = row.id; + if (id.substr(0,2) == 'ft') { + if (level < 1 || level == 3) { + row.classList.add('hiddenRow'); + } + else { + row.classList.remove('hiddenRow'); + } + } + if (id.substr(0,2) == 'pt') { + if (level > 1 && level != 3) { + row.classList.remove('hiddenRow'); + } + else { + row.classList.add('hiddenRow'); + } + } + if (id.substr(0,2) == 'st') { + if (level >=2) { + row.classList.remove('hiddenRow'); + } + else { + row.classList.add('hiddenRow'); + } + } + + + } +} + + +function showClassDetail(class_id, count) { + var testcases_list = Array(count); + var all_hidden = true; + for (var i = 0; i < count; i++) { + testcase_postfix_id = 't' + class_id.substr(1) + '.' + (i+1); + testcase_id = 'f' + testcase_postfix_id; + testcase = document.getElementById(testcase_id); + if (!testcase) { + testcase_id = 'p' + testcase_postfix_id; + testcase = document.getElementById(testcase_id); + } + if (!testcase) { + testcase_id = 's' + testcase_postfix_id; + testcase = document.getElementById(testcase_id); + } + testcases_list[i] = testcase; + if (testcase.classList.contains('hiddenRow')) { + all_hidden = false; + } + } + for (var i = 0; i < count; i++) { + testcase = testcases_list[i]; + if (!all_hidden) { + testcase.classList.remove('hiddenRow'); + } + else { + testcase.classList.add('hiddenRow'); + } + } +} + + +function showTestDetail(div_id){ + var details_div = document.getElementById(div_id) + var displayState = details_div.style.display + // alert(displayState) + if (displayState != 'block' ) { + displayState = 'block' + details_div.style.display = 'block' + } + else { + details_div.style.display = 'none' + } +} + + +function html_escape(s) { + s = s.replace(/&/g,'&'); + s = s.replace(//g,'>'); + return s; +} + +/* obsoleted by detail in
+function showOutput(id, name) { + var w = window.open("", //url + name, + "resizable,scrollbars,status,width=800,height=450"); + d = w.document; + d.write("
");
+    d.write(html_escape(output_list[id]));
+    d.write("\n");
+    d.write("close\n");
+    d.write("
\n"); + d.close(); +} +*/ +function drawCircle(pass, fail, error, skip){ + var color = ["#5cb85c","#d9534f","#c00","#f0ad4e"]; + var data = [pass,fail,error,skip]; + var text_arr = ["pass", "fail", "error","skip"]; + + var canvas = document.getElementById("circle"); + var ctx = canvas.getContext("2d"); + var startPoint=0; + var width = 20, height = 10; + var posX = 112 * 2 + 20, posY = 30; + var textX = posX + width + 5, textY = posY + 10; + for(var i=0;ilen-1){ + index=0; + clearInterval(start); //运行一轮后停止 + } + changeImg(index++); + } + imgyuan.style.width= 25*len +"px"; + //对应圆圈和图片同步 + function changeImg(index) { + var list = obj1.getElementsByTagName('img'); + var list1 = obj1.getElementsByTagName('font'); + for (i = 0; i < list.length; i++) { + list[i].style.display = 'none'; + list1[i].style.backgroundColor = 'white'; + } + list[index].style.display = 'block'; + list1[index].style.backgroundColor = 'blue'; + } + +} +function hide_img(obj){ + obj.parentElement.style.display = "none"; + obj.parentElement.getElementsByClassName('imgyuan')[0].innerHTML = ""; +} \ No newline at end of file