Commit a36325c9 authored by Samuel GAIST's avatar Samuel GAIST Committed by Flavio TARSETTI

[test][resourcemodels] Add tests for DatasetResourceModel

parent 52a5d51f
......@@ -32,6 +32,7 @@ from beat.backend.python.algorithm import Algorithm
from ..backend.resourcemodels import ExperimentResources
from ..backend.resourcemodels import AlgorithmResourceModel
from ..backend.resourcemodels import DatasetResourceModel
# ------------------------------------------------------------------------------
......@@ -159,3 +160,32 @@ class TestAlgorithmResourceModel:
assert algorithm_model.rowCount() == query.value("cnt")
class TestDatasetResourceModel:
"""Test the model used to generate suitable dataset selections"""
def prefix_model(self, beat_context):
return ExperimentResources(beat_context)
def test_default(self, prefix_model):
dataset_model = DatasetResourceModel()
query = QSqlQuery()
assert query.exec_("SELECT COUNT(name) AS cnt FROM datasets")
assert dataset_model.rowCount() == query.value("cnt")
def test_output_count(self, prefix_model):
dataset_model = DatasetResourceModel()
query = QSqlQuery()
assert query.exec_("SELECT COUNT(name) AS cnt FROM datasets WHERE outputs='2'")
assert dataset_model.rowCount() == query.value("cnt")
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment