-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into release-0.20.0
- Loading branch information
Showing
13 changed files
with
263 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#! /usr/bin/env python | ||
|
||
"""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 | ||
""" | ||
|
||
import datetime | ||
import os | ||
import pytest | ||
import random | ||
import string | ||
|
||
from jwql.database import database_interface as di | ||
|
||
# Determine if tests are being run on jenkins | ||
ON_JENKINS = os.path.expanduser('~') == '/home/jenkins' | ||
|
||
|
||
@pytest.mark.skipif(ON_JENKINS, reason='Requires access to development database server.') | ||
def test_anomaly_table(): | ||
"""Test to see that the database has an anomalies table""" | ||
|
||
assert 'anomaly' in di.engine.table_names() | ||
|
||
|
||
@pytest.mark.skipif(ON_JENKINS, reason='Requires access to development database server.') | ||
def test_anomaly_records(): | ||
"""Test to see that new records can be entered""" | ||
|
||
# Add some data | ||
random_string = ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.ascii_uppercase + string.digits) for _ in range(10)) | ||
di.session.add(di.Anomaly(rootname=random_string, flag_date=datetime.datetime.today(), user='test', ghost=True)) | ||
di.session.commit() | ||
|
||
# Test the ghosts column | ||
ghosts = di.session.query(di.Anomaly).filter(di.Anomaly.ghost == "True") | ||
assert ghosts.data_frame.iloc[0]['ghost'] == True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.