uga-libraries / general-aip

This is the general workflow to make archival information packages (AIPs) that are ready for ingest into the UGA Libraries' digital preservation system (ARCHive). The workflow organizes files, extracts and formats metadata, and packages the files. It may be used for any combination of file formats.
Creative Commons Attribution Share Alike 4.0 International
4 stars 0 forks source link

Make test for check_configuration function #13

Open amhanson9 opened 1 year ago

amhanson9 commented 1 year ago

I haven't figured out how to test this yet. The configuration file is read when the script runs, so I can't just pass incorrect values to the function.

The code is simple (test if variable exists and test if path exists) and I have tested it manually with configuration files that have errors, so it is a lower priority to figure this out.

amhanson9 commented 2 days ago

While addressing Issue 34, which updates this function, I made a basic unit test. It uses a configuration.py file in the tests folder that has a mix of all the errors and variables without errors. It's a start but could be improved:

The config file has to be renamed first to run the test, or the other unit tests use it instead of the correct one, which means it has to be run on its own and not as part of all tests for the script. It will fail when all tests are run, since it uses the corrected configuration.py.

And I couldn't give it separate configuration.py with errors separated out for different tests. I tried importing configuration_tests.py as c into the test document, hoping that would over-write the import of configuration.py as c in aip_functions, but that did not work.