From b555d046fb1a0370c41f470c19a9b4a4d6c13d1f Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 5 Sep 2022 12:38:03 +0300 Subject: Move data.gen_menu_json to test_data_set.py This is done to avoid relative imports. wqflask/tests/unit/base/data.py: Delete it. * wqflask/tests/unit/base/test_data_set.py: Add new variable GEN_MENU_JSON. (TestDataSetTypes.test_data_set_type_with_empty_redis): Upper-case "gen_menu_json" variable. --- wqflask/tests/unit/base/data.py | 110 ----------------------------- wqflask/tests/unit/base/test_data_set.py | 115 ++++++++++++++++++++++++++++++- 2 files changed, 113 insertions(+), 112 deletions(-) delete mode 100644 wqflask/tests/unit/base/data.py (limited to 'wqflask/tests/unit') diff --git a/wqflask/tests/unit/base/data.py b/wqflask/tests/unit/base/data.py deleted file mode 100644 index 06a5a989..00000000 --- a/wqflask/tests/unit/base/data.py +++ /dev/null @@ -1,110 +0,0 @@ -gen_menu_json = """ -{ - "datasets": { - "human": { - "HLC": { - "Liver mRNA": [ - [ - "320", - "HLC_0311", - "GSE9588 Human Liver Normal (Mar11) Both Sexes" - ] - ], - "Phenotypes": [ - [ - "635", - "HLCPublish", - "HLC Published Phenotypes" - ] - ] - } - }, - "mouse": { - "BXD": { - "Genotypes": [ - [ - "600", - "BXDGeno", - "BXD Genotypes" - ] - ], - "Hippocampus mRNA": [ - [ - "112", - "HC_M2_0606_P", - "Hippocampus Consortium M430v2 (Jun06) PDNN" - ] - ], - "Phenotypes": [ - [ - "602", - "BXDPublish", - "BXD Published Phenotypes" - ] - ] - } - } - }, - "groups": { - "human": [ - [ - "HLC", - "Liver: Normal Gene Expression with Genotypes (Merck)", - "Family:None" - ] - ], - "mouse": [ - [ - "BXD", - "BXD", - "Family:None" - ] - ] - }, - "species": [ - [ - "human", - "Human" - ], - [ - "mouse", - "Mouse" - ] - ], - "types": { - "human": { - "HLC": [ - [ - "Phenotypes", - "Traits and Cofactors", - "Phenotypes" - ], - [ - "Liver mRNA", - "Liver mRNA", - "Molecular Trait Datasets" - ] - ] - }, - "mouse": { - "BXD": [ - [ - "Phenotypes", - "Traits and Cofactors", - "Phenotypes" - ], - [ - "Genotypes", - "DNA Markers and SNPs", - "Genotypes" - ], - [ - "Hippocampus mRNA", - "Hippocampus mRNA", - "Molecular Trait Datasets" - ] - ] - } - } -} -""" diff --git a/wqflask/tests/unit/base/test_data_set.py b/wqflask/tests/unit/base/test_data_set.py index 505449a5..753981d8 100644 --- a/wqflask/tests/unit/base/test_data_set.py +++ b/wqflask/tests/unit/base/test_data_set.py @@ -4,10 +4,121 @@ import unittest from unittest import mock from wqflask import app -from .data import gen_menu_json from base.data_set import DatasetType +GEN_MENU_JSON = """ +{ + "datasets": { + "human": { + "HLC": { + "Liver mRNA": [ + [ + "320", + "HLC_0311", + "GSE9588 Human Liver Normal (Mar11) Both Sexes" + ] + ], + "Phenotypes": [ + [ + "635", + "HLCPublish", + "HLC Published Phenotypes" + ] + ] + } + }, + "mouse": { + "BXD": { + "Genotypes": [ + [ + "600", + "BXDGeno", + "BXD Genotypes" + ] + ], + "Hippocampus mRNA": [ + [ + "112", + "HC_M2_0606_P", + "Hippocampus Consortium M430v2 (Jun06) PDNN" + ] + ], + "Phenotypes": [ + [ + "602", + "BXDPublish", + "BXD Published Phenotypes" + ] + ] + } + } + }, + "groups": { + "human": [ + [ + "HLC", + "Liver: Normal Gene Expression with Genotypes (Merck)", + "Family:None" + ] + ], + "mouse": [ + [ + "BXD", + "BXD", + "Family:None" + ] + ] + }, + "species": [ + [ + "human", + "Human" + ], + [ + "mouse", + "Mouse" + ] + ], + "types": { + "human": { + "HLC": [ + [ + "Phenotypes", + "Traits and Cofactors", + "Phenotypes" + ], + [ + "Liver mRNA", + "Liver mRNA", + "Molecular Trait Datasets" + ] + ] + }, + "mouse": { + "BXD": [ + [ + "Phenotypes", + "Traits and Cofactors", + "Phenotypes" + ], + [ + "Genotypes", + "DNA Markers and SNPs", + "Genotypes" + ], + [ + "Hippocampus mRNA", + "Hippocampus mRNA", + "Molecular Trait Datasets" + ] + ] + } + } +} +""" + + class TestDataSetTypes(unittest.TestCase): """Tests for the DataSetType class""" @@ -50,7 +161,7 @@ class TestDataSetTypes(unittest.TestCase): """ with app.app_context(): - request_mock.return_value.content = gen_menu_json + request_mock.return_value.content = GEN_MENU_JSON redis_mock = mock.Mock() redis_mock.get.return_value = None data_set = DatasetType(redis_mock) -- cgit v1.2.3