Skip to content

Commit

Permalink
Add smoketests for tools/site_admin
Browse files Browse the repository at this point in the history
This now gives us basic coverage of almost all of the pages on PGDP.

From here, we can start filling different action types and data
to exercise different code paths.
  • Loading branch information
bpfoley authored and cpeel committed Mar 30, 2024
1 parent c7b5417 commit d36fe6e
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 19 deletions.
92 changes: 73 additions & 19 deletions SETUP/smoketests/pageload_smoketest.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,77 @@
{'path': 'tools/proofers/round.php?round_id=P3'},
{'path': 'tools/proofers/srchrep.php'},
]
TOOLS_SITE_ADMIN_TESTS = [
{'path': 'tools/site_admin/convert_project_table_utf8.php?projectid=projectID5e23a810ef693'},
{
'method': 'POST',
'path': 'tools/site_admin/copy_pages.php',
'data': {
'projectid_[from]': 'projectID5e23a810ef693',
'projectid_[to]': 'projectID3141592653589',
'from_image_[lo]': '004.png',
'from_image_[hi]': '005.png',
'page_name_handling': 'RENUMBER_PAGES',
'transfer_notifications': 0,
'add_deletion_reason': 0,
'merge_wordcheck_data': 0,
'repeat_project': 'NONE',
'action': 'docopy',
},
},
{
'method': 'POST',
'path': 'tools/site_admin/delete_pages.php',
'data': {
'projectid': 'projectID5e23a810ef693',
'from_image_[lo]': '004.png',
'from_image_[hi]': '005.png',
'action': 'check',
},
},
# TODO Needs rules table to be useful
{'path': 'tools/site_admin/displayrandrules.php'},
# TODO Needs rules table to be useful
{'path': 'tools/site_admin/manage_random_rules.php'},
# TODO Needs a non-activated user to be useful
{'path': 'tools/site_admin/edit_mail_address_for_non_activated_user.php'},
{'path': 'tools/site_admin/index.php'},
{'path': 'tools/site_admin/manage_site_access_privileges.php?username=teststeel'},
{'path': 'tools/site_admin/manage_site_charsuites.php'},
# TODO Needs some site wordlists
{'path': 'tools/site_admin/manage_site_word_lists.php'},
# TODO Needs some special day entries
{'path': 'tools/site_admin/manage_special_days.php'},
{
'method': 'POST',
'path': 'tools/site_admin/project_jump.php',
'data': {
'projectid': 'projectID5e23a810ef693',
'new_state': 'F2.proj_unavail',
'action': 'check',
},
},
{'path': 'tools/site_admin/projects_with_odd_values.php'},
{'path': 'tools/site_admin/rename_pages.php?projectid=projectID3141592653589'},
{
'method': 'POST',
'path': 'tools/site_admin/rename_pages.php',
'data': {
'projectid': 'projectID3141592653589',
'renumber_from_n': 'on',
'renumbering_start': 123,
'submit_button': 'Check renamings',
},
},
# TODO Needs conflicts to be useful
{'path': 'tools/site_admin/shared_postednums.php'},
# TODO Needs access_log entries to be useful
{'path': 'tools/site_admin/show_access_log.php'},
# TODO Needs overlapping word lists to be useful
{'path': 'tools/site_admin/show_common_words_from_project_word_lists.php'},
# TODO Needs news_items to be useful
{'path': 'tools/site_admin/sitenews.php'},
]

TESTS = (
NOLOGIN_TESTS +
Expand All @@ -410,27 +481,10 @@
TOOLS_AUTHORS_TESTS +
TOOLS_POST_PROOFERS_TESTS +
TOOLS_PROJECT_MANAGER_TESTS +
TOOLS_PROOFERS_TESTS
TOOLS_PROOFERS_TESTS +
TOOLS_SITE_ADMIN_TESTS
)

# {'path': 'tools/site_admin/convert_project_table_utf8.php'},
# {'path': 'tools/site_admin/copy_pages.php'},
# {'path': 'tools/site_admin/delete_pages.php'},
# {'path': 'tools/site_admin/displayrandrules.php'},
# {'path': 'tools/site_admin/edit_mail_address_for_non_activated_user.php'},
# {'path': 'tools/site_admin/index.php'},
# {'path': 'tools/site_admin/manage_random_rules.php'},
# {'path': 'tools/site_admin/manage_site_access_privileges.php'},
# {'path': 'tools/site_admin/manage_site_charsuites.php'},
# {'path': 'tools/site_admin/manage_site_word_lists.php'},
# {'path': 'tools/site_admin/manage_special_days.php'},
# {'path': 'tools/site_admin/project_jump.php'},
# {'path': 'tools/site_admin/projects_with_odd_values.php'},
# {'path': 'tools/site_admin/rename_pages.php'},
# {'path': 'tools/site_admin/shared_postednums.php'},
# {'path': 'tools/site_admin/show_access_log.php'},
# {'path': 'tools/site_admin/show_common_words_from_project_word_lists.php'},
# {'path': 'tools/site_admin/sitenews.php'},

def get_site_config() -> dict:
config = {}
Expand Down
1 change: 1 addition & 0 deletions SETUP/smoketests/smoketest_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ mkdir -p "${HOME}/projects/projectID5e23a810ef693"
for i in 001 002 003 004 005 illo; do
cp SETUP/smoketests/dot.png "${HOME}/projects/projectID5e23a810ef693/${i}.png"
done
mkdir -p "${HOME}/projects/projectID3141592653589"
33 changes: 33 additions & 0 deletions SETUP/smoketests/test_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SET FOREIGN_KEY_CHECKS=0;
* to be created with programmatic control of the project_id.
*/
REPLACE INTO `projects` VALUES ('*UTF-8 Practice','Lummis, Charles Fletcher','English','admin','notes','html','projectID5e23a810ef693','','',1704080514,1579564017,1579395673,1708309119,'','P3.proj_avail',NULL,'20200118BEGIN001','',417,1,0,'Folklore','beginner',0,'','',15,6,NULL,'TESTING','admin','admin','',0,'','');
REPLACE INTO `projects` VALUES ('An Empty Project','Fletcher, Jessica','English','admin','notes','html','projectID3141592653589','','',1704080514,1579564017,1579395673,1708309119,'','P3.proj_avail',NULL,'20200118BEGIN001','',417,1,0,'History','beginner',0,'','',15,6,NULL,'TESTING','admin','admin','',0,'','');

/* `users` rows populated by INSERTs in accounts/activate.php.
* Can't do this programatically yet.
Expand Down Expand Up @@ -73,3 +74,35 @@ REPLACE INTO `projectID5e23a810ef693` VALUES ('002','002.png','THE MAN WHO MARRI
REPLACE INTO `projectID5e23a810ef693` VALUES ('003','003.png','Copyright, 1891, 1892, 1894,\r\n\r\nBy THE CENTURY C0.\r\n\r\n\r\n\r\nTHE DEVINNE PREss;',1579633720,'sanspeur43','Copyright, 1891, 1892, 1894,\r\nBy THE CENTURY Co.\r\n\r\n\r\n\r\nTHE DE VINNE PREss.',1579651130,'jjz','\r\nCopyright, 1891, 1892, 1894,\r\nBy THE CENTURY Co.\r\n\r\nTHE DE VINNE PREss.',1708308890,'srjfoo','\r\nCopyright, 1891, 1892, 1894,\r\nBy THE CENTURY Co.\r\n\r\nThe De Vinne Press.',0,'','',0,'','','P3.page_saved','',0,'');
REPLACE INTO `projectID5e23a810ef693` VALUES ('004','004.png','To\r\nTHE FAIRY TALE THAT CAME TRUE IN\r\nTHE HOME OF THE TEE-WAHN\r\nMY WIFE AND CHILD',1579633808,'sanspeur43','To\r\nTHE FAIRY TALE THAT CAME TRUE IN\r\nTHE HOME OF THE TEE-WAHN\r\nMY WIFE AND CHILD',1579651187,'jjz','\r\nTo\r\nTHE FAIRY TALE THAT CAME TRUE IN\r\nTHE HOME OF THE TEE-WAHN\r\nMY WIFE AND CHILD',1708308955,'srjfoo','\r\nTo\r\nTHE FAIRY TALE THAT CAME TRUE IN\r\nTHE HOME OF THE TEE-WAHN\r\nMY WIFE AND CHILD',0,'','',0,'','','P3.page_saved','',0,'');
REPLACE INTO `projectID5e23a810ef693` VALUES ('005','005.png','',1579633830,'sanspeur43','[Blank Page]',1579651201,'jjz','[Blank Page]',1708308967,'srjfoo','[Blank Page]',0,'','',0,'','','P3.page_saved','',0,'');

DROP TABLE IF EXISTS `projectID3141592653589`;
CREATE TABLE `projectID3141592653589` (
fileid varchar(20) NOT NULL DEFAULT '', UNIQUE (fileid),
image varchar(12) NOT NULL DEFAULT '', UNIQUE (image),
master_text longtext NOT NULL,
round1_time int NOT NULL DEFAULT '0',
round1_user varchar(25) NOT NULL DEFAULT '',
round1_text longtext NOT NULL,
round2_time int NOT NULL DEFAULT '0',
round2_user varchar(25) NOT NULL DEFAULT '',
round2_text longtext COLLATE utf8mb4_general_ci NOT NULL,
round3_time int NOT NULL DEFAULT '0',
round3_user varchar(25) NOT NULL DEFAULT '',
round3_text longtext NOT NULL,
round4_time int NOT NULL DEFAULT '0',
round4_user varchar(25) NOT NULL DEFAULT '',
round4_text longtext NOT NULL,
round5_time int NOT NULL DEFAULT '0',
round5_user varchar(25) NOT NULL DEFAULT '',
round5_text longtext NOT NULL,
state varchar(50) NOT NULL DEFAULT '',
b_user varchar(25) NOT NULL DEFAULT '',
b_code int NOT NULL DEFAULT '0',
orig_page_num varchar(6) NOT NULL DEFAULT '',
KEY round1_user (round1_user),
KEY round2_user (round2_user),
KEY round3_user (round3_user),
KEY round4_user (round4_user),
KEY round5_user (round5_user),
KEY state (state)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;

0 comments on commit d36fe6e

Please sign in to comment.