@@ -23,21 +23,19 @@ def stunted_get():
2323
2424@pytest .fixture
2525def config_dict ():
26- return load_json (os .path .join ("testing_files" , "config_truncated.json" ))
26+ return load_json (os .path .join ("tests" , " testing_files" , "config_truncated.json" ))
2727
2828
2929
3030
3131def test_input_reading_and_checking (config_dict ):
32- config_json_filepath = os .path .join ("testing_files" , "config_truncated.json" )
32+ config_json_filepath = os .path .join ("tests" , " testing_files" , "config_truncated.json" )
3333
3434 expected_config_dict = config_dict
3535
3636 actual_config_dict = input_reading_and_checking (config_json_filepath , False , False , False , False )
3737
3838 assert expected_config_dict == actual_config_dict
39- < << << << Updated upstream
40- == == == =
4139
4240
4341def test_input_reading_and_checking_no_ORCID (config_dict ):
@@ -76,13 +74,12 @@ def test_input_reading_and_checking_no_Crossref_noGS(config_dict):
7674
7775 assert expected_config_dict == actual_config_dict
7876
79- > >> >> >> Stashed changes
8077
8178
8279
8380def test_generate_internal_data_and_check_authors (config_dict , capsys ):
84- expected_authors_by_project_dict = load_json (os .path .join ("testing_files" , "authors_by_project_dict_truncated.json" ))
85- expected_config_dict = load_json (os .path .join ("testing_files" , "config_truncated_authors_adjusted.json" ))
81+ expected_authors_by_project_dict = load_json (os .path .join ("tests" , " testing_files" , "authors_by_project_dict_truncated.json" ))
82+ expected_config_dict = load_json (os .path .join ("tests" , " testing_files" , "config_truncated_authors_adjusted.json" ))
8683
8784 actual_authors_by_project_dict , actual_config_dict = generate_internal_data_and_check_authors (config_dict )
8885
@@ -95,9 +92,9 @@ def test_generate_internal_data_and_check_authors(config_dict, capsys):
9592
9693
9794def test_build_publication_dict_all_sources (config_dict , mocker ):
98- config_dict = load_json (os .path .join ("testing_files" , "config_truncated.json" ))
95+ config_dict = load_json (os .path .join ("tests" , " testing_files" , "config_truncated.json" ))
9996
100- expected_pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
97+ expected_pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
10198 ## Add a fourth entry that is a copy of one of the others just to have a 4th to assign to the 4 different queries.
10299 expected_pub_dict ["32095798" ] = expected_pub_dict ["32095784" ]
103100
@@ -117,21 +114,16 @@ def mock_query4(*args, **kwargs):
117114 return {"32095798" :expected_pub_dict ["32095798" ]}
118115 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_webio.search_Google_Scholar_for_pubs" , mock_query4 )
119116
120- < << << << Updated upstream
121- actual_publication_dict , prev_pubs = build_publication_dict (config_dict , {}, False , False , False )
122- == == == =
123117 actual_publication_dict = build_publication_dict (config_dict , {}, False , False , False , False )
124- >> >> >> > Stashed changes
125118
126119 assert expected_pub_dict == actual_publication_dict
127- assert expected_pub_dict == prev_pubs
128120
129121
130122
131123def test_build_publication_dict_no_ORCID (config_dict , mocker ):
132- config_dict = load_json (os .path .join ("testing_files" , "config_truncated.json" ))
124+ config_dict = load_json (os .path .join ("tests" , " testing_files" , "config_truncated.json" ))
133125
134- expected_pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
126+ expected_pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
135127 ## Add a fourth entry that is a copy of one of the others just to have a 4th to assign to the 4 different queries.
136128 expected_pub_dict ["32095798" ] = expected_pub_dict ["32095784" ]
137129 del expected_pub_dict ["https://doi.org/10.1002/adhm.202101820" ]
@@ -152,21 +144,16 @@ def mock_query4(*args, **kwargs):
152144 return {"32095798" :expected_pub_dict ["32095798" ]}
153145 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_webio.search_Google_Scholar_for_pubs" , mock_query4 )
154146
155- < << << << Updated upstream
156- actual_publication_dict , prev_pubs = build_publication_dict (config_dict , {}, True , False , False )
157- == == == =
158147 actual_publication_dict = build_publication_dict (config_dict , {}, True , False , False , False )
159- >> >> >> > Stashed changes
160148
161149 assert expected_pub_dict == actual_publication_dict
162- assert expected_pub_dict == prev_pubs
163150
164151
165152
166153def test_build_publication_dict_no_Crossref (config_dict , mocker ):
167- config_dict = load_json (os .path .join ("testing_files" , "config_truncated.json" ))
154+ config_dict = load_json (os .path .join ("tests" , " testing_files" , "config_truncated.json" ))
168155
169- expected_pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
156+ expected_pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
170157 ## Add a fourth entry that is a copy of one of the others just to have a 4th to assign to the 4 different queries.
171158 expected_pub_dict ["32095798" ] = expected_pub_dict ["32095784" ]
172159 del expected_pub_dict ["https://doi.org/10.1002/advs.202101999" ]
@@ -187,21 +174,16 @@ def mock_query4(*args, **kwargs):
187174 return {"32095798" :expected_pub_dict ["32095798" ]}
188175 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_webio.search_Google_Scholar_for_pubs" , mock_query4 )
189176
190- < << << << Updated upstream
191- actual_publication_dict , prev_pubs = build_publication_dict (config_dict , {}, False , False , True )
192- == == == =
193177 actual_publication_dict = build_publication_dict (config_dict , {}, False , False , True , False )
194- >> >> >> > Stashed changes
195178
196179 assert expected_pub_dict == actual_publication_dict
197- assert expected_pub_dict == prev_pubs
198180
199181
200182
201183def test_build_publication_dict_no_Google_Scholar (config_dict , mocker ):
202- config_dict = load_json (os .path .join ("testing_files" , "config_truncated.json" ))
184+ config_dict = load_json (os .path .join ("tests" , " testing_files" , "config_truncated.json" ))
203185
204- expected_pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
186+ expected_pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
205187 ## Add a fourth entry that is a copy of one of the others just to have a 4th to assign to the 4 different queries.
206188 expected_pub_dict ["32095798" ] = expected_pub_dict ["32095784" ]
207189 del expected_pub_dict ["32095798" ]
@@ -222,9 +204,6 @@ def mock_query4(*args, **kwargs):
222204 return {"32095798" :expected_pub_dict ["32095798" ]}
223205 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_webio.search_Google_Scholar_for_pubs" , mock_query4 )
224206
225- < << << << Updated upstream
226- actual_publication_dict , prev_pubs = build_publication_dict (config_dict , {}, False , True , False )
227- == == == =
228207 actual_publication_dict = build_publication_dict (config_dict , {}, False , True , False , False )
229208
230209 assert expected_pub_dict == actual_publication_dict
@@ -289,15 +268,13 @@ def mock_query4(*args, **kwargs):
289268 actual_publication_dict = build_publication_dict (config_dict , prev_pubs , False , False , False , False )
290269
291270 del expected_pub_dict ["32095798" ]
292- >> >> >> > Stashed changes
293271
294272 assert expected_pub_dict == actual_publication_dict
295- assert expected_pub_dict == prev_pubs
296273
297274
298275
299276def test_build_publication_dict_no_pubs_found (config_dict , mocker , capsys ):
300- config_dict = load_json (os .path .join ("testing_files" , "config_truncated.json" ))
277+ config_dict = load_json (os .path .join ("tests" , " testing_files" , "config_truncated.json" ))
301278
302279 def mock_query (* args , ** kwargs ):
303280 return {}
@@ -316,11 +293,7 @@ def mock_query4(*args, **kwargs):
316293 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_webio.search_Google_Scholar_for_pubs" , mock_query4 )
317294
318295 with pytest .raises (SystemExit ):
319- < << << << Updated upstream
320- actual_publication_dict , prev_pubs = build_publication_dict (config_dict , {}, False , False , False )
321- == == == =
322296 actual_publication_dict = build_publication_dict (config_dict , {}, False , False , False , False )
323- >> >> >> > Stashed changes
324297
325298 captured = capsys .readouterr ()
326299 expected_message = "No new publications found." + "\n "
@@ -335,16 +308,16 @@ def emails(*args, **kwargs):
335308 return {"creation_date" :"asdf" , "emails" :[]}
336309 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_emails_and_reports.create_project_reports_and_emails" , emails )
337310
338- pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
339- authors_by_project_dict = load_json (os .path .join ("testing_files" , "authors_by_project_dict_truncated.json" ))
311+ pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
312+ authors_by_project_dict = load_json (os .path .join ("tests" , " testing_files" , "authors_by_project_dict_truncated.json" ))
340313
341314 config_dict ["summary_report" ] = {}
342- config_dict ["summary_report" ]["template" ] = read_text_from_txt (os .path .join ("testing_files" , "athr_srch_build_loop_template_string.txt" ))
315+ config_dict ["summary_report" ]["template" ] = read_text_from_txt (os .path .join ("tests" , " testing_files" , "athr_srch_build_loop_template_string.txt" ))
343316
344317 save_dir = save_and_send_reports_and_emails (authors_by_project_dict , pub_dict , config_dict , True )
345318
346319 assert os .path .exists (os .path .join (save_dir , "summary_report.txt" ))
347- assert read_text_from_txt (os .path .join ("testing_files" , "athr_srch_summary_report_custom_template.txt" )) == read_text_from_txt (os .path .join (save_dir , "summary_report.txt" ))
320+ assert read_text_from_txt (os .path .join ("tests" , " testing_files" , "athr_srch_summary_report_custom_template.txt" )) == read_text_from_txt (os .path .join (save_dir , "summary_report.txt" ))
348321 assert not os .path .exists (os .path .join (save_dir , "emails.json" ))
349322
350323
@@ -355,11 +328,11 @@ def emails(*args, **kwargs):
355328 return {"creation_date" :"asdf" , "emails" :[]}
356329 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_emails_and_reports.create_project_reports_and_emails" , emails )
357330
358- pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
359- authors_by_project_dict = load_json (os .path .join ("testing_files" , "authors_by_project_dict_truncated.json" ))
331+ pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
332+ authors_by_project_dict = load_json (os .path .join ("tests" , " testing_files" , "authors_by_project_dict_truncated.json" ))
360333
361334 config_dict ["summary_report" ] = {}
362- config_dict ["summary_report" ]["template" ] = read_text_from_txt (os .path .join ("testing_files" , "athr_srch_build_loop_template_string.txt" ))
335+ config_dict ["summary_report" ]["template" ] = read_text_from_txt (os .path .join ("tests" , " testing_files" , "athr_srch_build_loop_template_string.txt" ))
363336 config_dict [
"summary_report" ][
"from_email" ]
= "[email protected] " 364337 config_dict [
"summary_report" ][
"to_email" ]
= [
"[email protected] " ]
365338 config_dict [
"summary_report" ][
"cc_email" ]
= [
"[email protected] " ]
@@ -369,7 +342,7 @@ def emails(*args, **kwargs):
369342 save_dir = save_and_send_reports_and_emails (authors_by_project_dict , pub_dict , config_dict , True )
370343
371344 assert os .path .exists (os .path .join (save_dir , "summary_report.txt" ))
372- assert read_text_from_txt (os .path .join ("testing_files" , "athr_srch_summary_report_custom_template.txt" )) == read_text_from_txt (os .path .join (save_dir , "summary_report.txt" ))
345+ assert read_text_from_txt (os .path .join ("tests" , " testing_files" , "athr_srch_summary_report_custom_template.txt" )) == read_text_from_txt (os .path .join (save_dir , "summary_report.txt" ))
373346 assert os .path .exists (os .path .join (save_dir , "emails.json" ))
374347
375348
@@ -380,15 +353,15 @@ def emails(*args, **kwargs):
380353 return {"creation_date" :"asdf" , "emails" :[]}
381354 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_emails_and_reports.create_project_reports_and_emails" , emails )
382355
383- pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
384- authors_by_project_dict = load_json (os .path .join ("testing_files" , "authors_by_project_dict_truncated.json" ))
356+ pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
357+ authors_by_project_dict = load_json (os .path .join ("tests" , " testing_files" , "authors_by_project_dict_truncated.json" ))
385358
386359 config_dict ["summary_report" ] = {}
387360
388361 save_dir = save_and_send_reports_and_emails (authors_by_project_dict , pub_dict , config_dict , True )
389362
390363 assert os .path .exists (os .path .join (save_dir , "summary_report.txt" ))
391- assert read_text_from_txt (os .path .join ("testing_files" , "athr_srch_summary_report.txt" )) == read_text_from_txt (os .path .join (save_dir , "summary_report.txt" ))
364+ assert read_text_from_txt (os .path .join ("tests" , " testing_files" , "athr_srch_summary_report.txt" )) == read_text_from_txt (os .path .join (save_dir , "summary_report.txt" ))
392365 assert not os .path .exists (os .path .join (save_dir , "emails.json" ))
393366
394367
@@ -398,8 +371,8 @@ def emails(*args, **kwargs):
398371 return {"creation_date" :"asdf" , "emails" :[]}
399372 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_emails_and_reports.create_project_reports_and_emails" , emails )
400373
401- pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
402- authors_by_project_dict = load_json (os .path .join ("testing_files" , "authors_by_project_dict_truncated.json" ))
374+ pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
375+ authors_by_project_dict = load_json (os .path .join ("tests" , " testing_files" , "authors_by_project_dict_truncated.json" ))
403376
404377 config_dict [
"Authors" ][
"Anna Hoover" ][
"collaborator_report" ]
= {
"from_email" :
"[email protected] " ,
405378 "email_body" :"asdf" ,
@@ -418,8 +391,8 @@ def emails(*args, **kwargs):
418391 return {"creation_date" :"asdf" , "emails" :[]}
419392 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_emails_and_reports.create_project_reports_and_emails" , emails )
420393
421- pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
422- authors_by_project_dict = load_json (os .path .join ("testing_files" , "authors_by_project_dict_truncated.json" ))
394+ pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
395+ authors_by_project_dict = load_json (os .path .join ("tests" , " testing_files" , "authors_by_project_dict_truncated.json" ))
423396
424397 config_dict ["summary_report" ] = {}
425398 config_dict ["summary_report" ]["columns" ] = {"Col1" :"<project_name>" }
@@ -436,11 +409,11 @@ def emails(*args, **kwargs):
436409 return {"creation_date" :"asdf" , "emails" :[]}
437410 mocker .patch ("academic_tracker.athr_srch_modularized.athr_srch_emails_and_reports.create_project_reports_and_emails" , emails )
438411
439- pub_dict = load_json (os .path .join ("testing_files" , "publication_dict_truncated.json" ))
440- authors_by_project_dict = load_json (os .path .join ("testing_files" , "authors_by_project_dict_truncated.json" ))
412+ pub_dict = load_json (os .path .join ("tests" , " testing_files" , "publication_dict_truncated.json" ))
413+ authors_by_project_dict = load_json (os .path .join ("tests" , " testing_files" , "authors_by_project_dict_truncated.json" ))
441414
442415 config_dict ["summary_report" ] = {}
443- config_dict ["summary_report" ]["template" ] = read_text_from_txt (os .path .join ("testing_files" , "athr_srch_build_loop_template_string.txt" ))
416+ config_dict ["summary_report" ]["template" ] = read_text_from_txt (os .path .join ("tests" , " testing_files" , "athr_srch_build_loop_template_string.txt" ))
444417 config_dict ["summary_report" ]["filename" ] = "test_name.txt"
445418
446419 save_dir = save_and_send_reports_and_emails (authors_by_project_dict , pub_dict , config_dict , True )
0 commit comments