Skip to content

Commit

Permalink
Added docstrings and minor edits based on flake8 suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
bourque committed Aug 16, 2018
1 parent 7de0f8d commit 78a7fdf
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions jwql/tests/test_website.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
"""Tests for the JWQL web application.
"""Tests for the ``jwql`` web application.
Authors
-------
Expand All @@ -9,13 +9,14 @@
Use
---
These tests can be run via the command line (omit the -s to
suppress verbose output to stdout):
These tests can be run via the command line (omit the ``-s`` to
suppress verbose output to ``stdout``):
::
pytest -s test_website.py
"""

import sys
sys.path.append("../..")

Expand All @@ -24,18 +25,23 @@
from jwql.utils.utils import JWST_INSTRUMENTS
from website.apps.jwql.data_containers import (
get_acknowledgements, get_dashboard_components,
get_filenames_by_instrument, get_header_info, get_image_info,
get_proposal_info, thumbnails
get_filenames_by_instrument, get_header_info
)


def test_acknowledgements():
"""Checks that an acknowledgements list exists and has content."""

acknowledgements = get_acknowledgements()
assert isinstance(acknowledgements, list), 'Acknowledgements in invalid form'
assert len(acknowledgements) > 0, 'No acknowledgements listed'


def test_dashboard():
"""Checks that there are dashboard components to display. Also
checks that the components have required HTML components.
"""

dashboard_components = get_dashboard_components()
assert len(dashboard_components) > 0, 'No dashboard components found'

Expand All @@ -47,13 +53,21 @@ def test_dashboard():


@pytest.mark.xfail
def test_inst_filenames():
def test_get_filesname_by_instrument():
"""Checks that the `get_filenames_by_instrument` function returns
files for each instrument.
"""

for instrument in JWST_INSTRUMENTS:
filepaths = get_filenames_by_instrument(instrument)
assert len(filepaths) > 0, 'No {} files found in filesystem'.format(instrument)


@pytest.mark.xfail
def test_header():
def test_get_header_info():
"""Checks that the `get_header_info` function returns a valid
header.
"""

header = get_header_info('jw86700007001_02101_00001_guider2_trapsfilled.fits')
assert header.startswith('SIMPLE')

0 comments on commit 78a7fdf

Please sign in to comment.