Skip to content

Commit

Permalink
Working tests with new sqlite backend store
Browse files Browse the repository at this point in the history
see #35
  • Loading branch information
emmanuel valette committed Dec 27, 2016
1 parent e58e3c3 commit d23fd7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions oct/tools/rebuild_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from oct.core.exceptions import OctConfigurationError

from oct.results.output import output
from oct.results.models import db, set_database
from oct.utilities.configuration import configure, get_db_uri


Expand All @@ -17,7 +16,7 @@ def rebuild(args):
if not db_uri:
raise OctConfigurationError("Bad database configured, if you use sqlite database use -f option")

set_database(db_uri, db, config)
config['results_database'] = {'db_uri': db_uri}
output(args.results_dir, config)


Expand Down
12 changes: 9 additions & 3 deletions tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest

from oct.results.report import ReportResults
from oct.results.models import set_database, db
from oct.result_backends.sqlite import SQLiteLoader

BASE_DIR = os.path.dirname(os.path.realpath(__file__))

Expand All @@ -12,6 +12,12 @@ class ReportTest(unittest.TestCase):
def test_empty_results(self):
"""Test report with empty results
"""
set_database(os.path.join(BASE_DIR, 'fixtures', 'empty_results.sqlite'), db, {})
report = ReportResults(60, 10)
config = {
'testing': False,
'results_database': {
'db_uri': os.path.join(BASE_DIR, 'fixtures', 'empty_results.sqlite')
}
}
loader = SQLiteLoader(config, '')
report = ReportResults(60, 10, loader)
report.compile_results()

0 comments on commit d23fd7e

Please sign in to comment.