tests

test_api_views.py

Tests for the api_views module in the jwql web application.

Authors

  • Matthew Bourque

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_api_views.py
jwql.tests.test_api_views.test_api_views(url)[source]

Test to see if the given url returns a populated JSON object

Parameters:
urlstr

The url to the api view of interest (e.g. http://127.0.0.1:8000/api/86700/filenames/').

test_bad_pixel_monitor.py

Tests for the bad pixel monitor module.

Authors

  • Bryan Hilbert

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_badpix_monitor.py
jwql.tests.test_bad_pixel_monitor.test_bad_map_to_list()[source]

Check that bad pixel locations are correctly retrieved from an image

jwql.tests.test_bad_pixel_monitor.test_check_for_sufficient_files()[source]

Be sure that the file threshold values are being used correctly

jwql.tests.test_bad_pixel_monitor.test_exclude_crds_mask_pix()[source]

Test that bad pixel images are differentiated correctly

jwql.tests.test_bad_pixel_monitor.test_filter_query_results()[source]

Test MAST query filtering to extract most common filter/pupil and acceptable readout patterns

jwql.tests.test_bad_pixel_monitor.test_get_possible_apertures(instrument, expected_list)[source]

Make sure the correct apertures are returned for the given instrument

jwql.tests.test_bad_pixel_monitor.test_identify_tables()[source]

Be sure the correct database tables are identified

jwql.tests.test_bad_pixel_monitor.test_locate_rate_files()[source]

Test that rate files are found in filesystem

jwql.tests.test_bad_pixel_monitor.test_locate_uncal_files()[source]

Test the filesystem search for uncal files

jwql.tests.test_bad_pixel_monitor.test_make_crds_parameter_dict()[source]

Test that the dictionary to be used for CRDS queries is properly created

test_bias_monitor.py

Tests for the bias_monitor module.

Authors

  • Ben Sunnquist

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_bias_monitor.py
jwql.tests.test_bias_monitor.test_collapse_image()[source]

Test that the image is collapsed correctly along its axes

jwql.tests.test_bias_monitor.test_extract_zeroth_group()[source]

Test the zeroth group file creation

jwql.tests.test_bias_monitor.test_get_amp_medians()[source]

Test that the amp medians are calculated correctly

jwql.tests.test_bias_monitor.test_identify_tables()[source]

Be sure the correct database tables are identified

jwql.tests.test_bias_monitor.test_make_histogram()[source]

Test histogram creation

test_calculations.py

Tests for the calculations module.

Authors

  • Bryan Hilbert

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_calculations.py
jwql.tests.test_calculations.test_double_gaussian_fit()[source]

Test the double Gaussian fitting function

jwql.tests.test_calculations.test_gaussian1d_fit()[source]

Test histogram fitting function

jwql.tests.test_calculations.test_mean_image()[source]

Test the sigma-clipped mean and stdev image calculator

jwql.tests.test_calculations.test_mean_stdev()[source]

Test calcualtion of the sigma-clipped mean from an image

test_dark_monitor.py

Tests for the dark_monitor module.

Authors

  • Bryan Hilbert

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_dark_monitor.py
jwql.tests.test_dark_monitor.test_find_hot_dead_pixels()[source]

Test hot and dead pixel searches

jwql.tests.test_dark_monitor.test_get_metadata()[source]

Test retrieval of metadata from input file

jwql.tests.test_dark_monitor.test_mast_query_darks()[source]

Test that the MAST query for darks is functional

jwql.tests.test_dark_monitor.test_noise_check()[source]

Test the search for noisier than average pixels

jwql.tests.test_dark_monitor.test_shift_to_full_frame()[source]

Test pixel coordinate shifting to be in full frame coords

test_data_containers.py

Tests for the data_containers module in the jwql web application.

Authors

  • Matthew Bourque

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_data_containers.py
jwql.tests.test_data_containers.test_get_acknowledgements()[source]

Tests the get_acknowledgements function.

jwql.tests.test_data_containers.test_get_all_proposals()[source]

Tests the get_all_proposals function.

jwql.tests.test_data_containers.test_get_expstart()[source]

Tests the get_expstart function.

jwql.tests.test_data_containers.test_get_filenames_by_instrument()[source]

Tests the get_filenames_by_instrument function.

jwql.tests.test_data_containers.test_get_filenames_by_proposal()[source]

Tests the get_filenames_by_proposal function.

jwql.tests.test_data_containers.test_get_filenames_by_rootname()[source]

Tests the get_filenames_by_rootname function.

jwql.tests.test_data_containers.test_get_header_info()[source]

Tests the get_header_info function.

jwql.tests.test_data_containers.test_get_image_info()[source]

Tests the get_image_info function.

jwql.tests.test_data_containers.test_get_instrument_proposals()[source]

Tests the get_instrument_proposals function.

jwql.tests.test_data_containers.test_get_preview_images_by_instrument()[source]

Tests the get_preview_images_by_instrument function.

jwql.tests.test_data_containers.test_get_preview_images_by_proposal()[source]

Tests the get_preview_images_by_proposal function.

jwql.tests.test_data_containers.test_get_preview_images_by_rootname()[source]

Tests the get_preview_images_by_rootname function.

jwql.tests.test_data_containers.test_get_proposal_info()[source]

Tests the get_proposal_info function.

jwql.tests.test_data_containers.test_get_thumbnails_by_instrument()[source]

Tests the get_thumbnails_by_instrument function.

jwql.tests.test_data_containers.test_get_thumbnails_by_proposal()[source]

Tests the get_thumbnails_by_proposal function.

jwql.tests.test_data_containers.test_get_thumbnails_by_rootname()[source]

Tests the get_thumbnails_by_rootname function.

jwql.tests.test_data_containers.test_thumbnails_ajax()[source]

Tests the get_thumbnails_ajax function.

test_database_interface.py

Tests for the database_interface.py module.

Authors

  • Joe Filippazzo

  • Matthew Bourque

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s database_interface.py
jwql.tests.test_database_interface.test_all_tables_exist()[source]

Test that the table ORMs defined in database_interface actually exist as tables in the database

jwql.tests.test_database_interface.test_anomaly_orm_factory()[source]

Test that the anomaly_orm_factory function successfully creates an ORM and contains the appropriate columns

jwql.tests.test_database_interface.test_anomaly_records()[source]

Test to see that new records can be entered

jwql.tests.test_database_interface.test_load_connections()[source]

Test to see that a connection to the database can be established

jwql.tests.test_database_interface.test_monitor_orm_factory()[source]

Test that the monitor_orm_factory function successfully creates an ORM and contains the appropriate columns

test_edb.py

Tests for the engineering_database module.

Authors

  • Johannes Sahlmann

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_edb.py
jwql.tests.test_edb.test_get_mnemonic()[source]

Test the query of a single mnemonic.

jwql.tests.test_edb.test_get_mnemonic_info()[source]

Test retrieval of mnemonic info.

jwql.tests.test_edb.test_get_mnemonics()[source]

Test the query of a list of mnemonics.

test_instrument_properties.py

Tests for the instrument_properties module.

Authors

  • Bryan Hilbert

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_instrument_properties.py
jwql.tests.test_instrument_properties.test_amplifier_info()[source]

Test that the correct number of amplifiers are found for a given file

jwql.tests.test_instrument_properties.test_calc_frame_time()[source]

Test calcuation of frametime for a given instrument/aperture

test_loading_times.py

Tests various webpages of the jwql web application to make sure that loading times are not too long

Authors

  • Matthew Bourque

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_loading_times.py
jwql.tests.test_loading_times.test_loading_times(url)[source]

Test to see if the given url returns a webpage successfully within a reasonable time.

Parameters:
urlstr

The url to the webpage of interest (e.g. http://127.0.0.1:8000/fgs/archive/').

test_logging_functions.py

Tests for the logging_functions module.

Authors

  • Matthew Bourque

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_logging_functions.py
jwql.tests.test_logging_functions.perform_basic_logging()[source]

Performs some basic logging to the test log file

jwql.tests.test_logging_functions.test_configure_logging()[source]

Assert that the configure_logging function successfully creates a log file

jwql.tests.test_logging_functions.test_logging_functions()[source]

A generic end-to-end test that creates a log file, does some basic logging, then asserts that some logging content exists

jwql.tests.test_logging_functions.test_make_log_file()[source]

Assert that make_log_file function returns the appropriate path for a log file

test_monitor_mast.py

Tests for the monitor_mast module.

Authors

Joe Filippazzo

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_monitor_mast.py
jwql.tests.test_monitor_mast.test_astroquery_mast()[source]

Test if the astroquery.mast service can complete a request

jwql.tests.test_monitor_mast.test_caom_instrument_keywords()[source]

Test to see that the CAOM keywords are the same for all instruments

jwql.tests.test_monitor_mast.test_filtered_instrument_keywords()[source]

Test to see that the instrument specific service keywords are different for all instruments

jwql.tests.test_monitor_mast.test_instrument_dataproduct_filtering()[source]

Test to see that the instrument inventory can be filtered by data product

jwql.tests.test_monitor_mast.test_instrument_inventory_filtering()[source]

Test to see that the instrument inventory can be filtered

test_permissions.py

Tests for the permissions module.

Authors

  • Johannes Sahlmann

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_permissions.py
jwql.tests.test_permissions.test_directory(test_dir='/home/docs/permission_test')[source]

Create a test directory for permission management.

Parameters:
test_dirstr

Path to directory used for testing

Yields:
test_dirstr

Path to directory used for testing

jwql.tests.test_permissions.test_directory_permissions(test_directory)[source]

Create a directory with the standard permissions ('-rw-r--r--').

Set the default permissions defined in permissions.py. Assert that these were set correctly.

Parameters:
test_directorystr

Path of directory used for testing

jwql.tests.test_permissions.test_file(test_dir='/home/docs/permission_test')[source]

Create a test file for permission management.

Parameters:
test_dirstr

Path to directory used for testing

Yields:
filenamestr

Path of file used for testing

jwql.tests.test_permissions.test_file_group(test_file)[source]

Create a file with the standard permissions ('-rw-r--r--') and default group.

Modify the group and set the default permissions defined in permissions.py. Assert that both group and permissions were set correctly.

Parameters:
test_filestr

Path of file used for testing

jwql.tests.test_permissions.test_file_permissions(test_file)[source]

Create a file with the standard permissions ('-rw-r--r--').

Set the default permissions defined in permissions.py. Assert that these were set correctly.

Parameters:
test_filestr

Path of file used for testing

test_pipeline_tools.py

Tests for the pipeline_tools module.

Authors

  • Bryan Hilbert

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_pipeline_tools.py
jwql.tests.test_pipeline_tools.test_completed_pipeline_steps()[source]

Test that the list of completed pipeline steps for a file is correct

Parameters:
filenamestr

File to be checked

jwql.tests.test_pipeline_tools.test_get_pipeline_steps()[source]

Test that the proper pipeline steps are returned for an instrument

jwql.tests.test_pipeline_tools.test_image_stack()[source]

Test stacking of slope images

jwql.tests.test_pipeline_tools.test_steps_to_run()[source]

Test that the dictionaries for steps required and steps completed are correctly combined to create a dictionary of pipeline steps to be done

Parameters:
filenamestr

File to be checked

requiredOrderedDict

Dict of all pipeline steps to be run on filename

already_doneOrderedDict

Dict of pipeline steps already run on filename

test_plotting.py

Tests for the plotting module.

Authors

  • Joe Filippazzo

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_plotting.py
jwql.tests.test_plotting.test_bar_chart()[source]

Make sure some dummy data generates a bokeh plot

jwql.tests.test_plotting.test_bokeh_version()[source]

Make sure that the current version of Bokeh matches the version being used in all the web app HTML templates.

test_preview_image.py

Tests for the preview_image module.

Authors

  • Johannes Sahlmann

  • Lauren Chambers

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_preview_image.py
jwql.tests.test_preview_image.get_test_fits_files()[source]

Get a list of the FITS files on central storage to make preview images.

Returns:
filenameslist

List of filepaths to FITS files

jwql.tests.test_preview_image.test_directory(test_dir='/home/docs/preview_image_test')[source]

Create a test directory for preview image.

Parameters:
test_dirstr

Path to directory used for testing

Yields:
test_dirstr

Path to directory used for testing

jwql.tests.test_preview_image.test_make_image(test_directory, filename)[source]

Use PreviewImage.make_image to create preview images of a sample JWST exposure.

Assert that the number of JPGs created corresponds to the number of integrations.

Parameters:
test_directorystr

Path of directory used for testing

filenamestr

Path of FITS image to generate preview of

test_readnoise_monitor.py

Tests for the readnoise_monitor module.

Authors

  • Ben Sunnquist

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_readnoise_monitor.py
jwql.tests.test_readnoise_monitor.test_determine_pipeline_steps()[source]

Test the correct pipeline steps are called

jwql.tests.test_readnoise_monitor.test_get_amp_stats()[source]

Test amp stat calculations

jwql.tests.test_readnoise_monitor.test_get_metadata()[source]

Test retrieval of metadata from input file

jwql.tests.test_readnoise_monitor.test_identify_tables()[source]

Be sure the correct database tables are identified

jwql.tests.test_readnoise_monitor.test_make_histogram()[source]

Test histogram creation

jwql.tests.test_readnoise_monitor.test_make_readnoise_image()[source]

Test readnoise image creation

test_setup.py

Tests for the setup.py module.

Authors

  • Bryan Hilbert

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_setup_info.py
jwql.tests.test_setup.test_version_number()[source]

Test that the JWQL version number is retrieved from setup.py

test_utils.py

Tests for the utils module.

Authors

  • Lauren Chambers

  • Matthew Bourque

Use

These tests can be run via the command line (omit the -s to suppress verbose output to stdout):

pytest -s test_utils.py
jwql.tests.test_utils.test_copy_files()[source]

Test that files are copied successfully

jwql.tests.test_utils.test_filename_parser(filename, solution)[source]

Generate a dictionary with parameters from a JWST filename. Assert that the dictionary matches what is expected.

Parameters:
filenamestr

The filename to test (e.g. jw00327001001_02101_00002_nrca1_rate.fits)

solutiondict

A dictionary of the expected result

jwql.tests.test_utils.test_filename_parser_nonJWST()[source]

Attempt to generate a file parameter dictionary from a file that is not formatted in the JWST naming convention. Ensure the appropriate error is raised.

jwql.tests.test_utils.test_filename_parser_whole_filesystem()[source]

Test the filename_parser on all files currently in the filesystem.

jwql.tests.test_utils.test_filesystem_path()[source]

Test that a file’s location in the filesystem is returned

jwql.tests.test_utils.test_get_config()[source]

Assert that the get_config function successfully creates a dictionary.

jwql.tests.test_utils.test_validate_config()[source]

Test that the config validator works.