cerc_persistence/unittests/test_db_retrieve.py

36 lines
1.2 KiB
Python
Raw Permalink Normal View History

"""
Test db retrieve
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Ruben Sanchez ruben.sanchez@mail.concordia.ca
"""
import datetime
import unittest
from unittest import TestCase
from unittests.control import Control
control = Control()
class TestDBFactory(TestCase):
"""
TestDBFactory
"""
@unittest.skipIf(control.skip_test, control.skip_reason)
def test_retrieve_results(self):
datetime.datetime.now()
request_values = {
"scenarios": [
{"current status": ["01002777", "01002773", "01036804"]},
{"skin retrofit": ["01002777", "01002773", "01036804"]},
{"system retrofit and pv": ["01002777", "01002773", "01036804"]},
{"skin and system retrofit with pv": ["01002777", "01002773", "01036804"]}
]
}
results = control.database.results(control.user_id, control.application_id, request_values)
scenarios = ['current status', 'skin retrofit', 'system retrofit and pv', 'skin and system retrofit with pv']
for key, value in results.items():
self.assertTrue(key in scenarios, 'Wrong key value')
self.assertEqual(len(value), 0, 'wrong number of results')