From 0b962eef391db6aae100a3283e89ee0ac0101f6b Mon Sep 17 00:00:00 2001 From: Alexanderlacuna Date: Sat, 31 Oct 2020 15:23:45 +0300 Subject: remove redundant classes --- .../tests/wqflask/show_trait/test_export_trait_data.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'wqflask') diff --git a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py b/wqflask/tests/wqflask/show_trait/test_export_trait_data.py index bd2f7dac..41761944 100644 --- a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py +++ b/wqflask/tests/wqflask/show_trait/test_export_trait_data.py @@ -12,10 +12,6 @@ class AttributesSetter: setattr(self, key, value) -class HelperClass: - pass - - class TestExportTraits(unittest.TestCase): """Test methods related to converting dict to sortedlist""" @mock.patch("wqflask.show_trait.export_trait_data.create_trait") @@ -25,12 +21,11 @@ class TestExportTraits(unittest.TestCase): mock_dataset_attributes = AttributesSetter( {"type": "no_publish", "dataset_name": "Temp", "name": "Temp"}) - mock_nested_attributes = HelperClass() - mock_nested_attributes.name = "name" + mock_nested_attributes = AttributesSetter({"name": "name"}) mock_dataset_attributes.group = mock_nested_attributes mock_dataset.create_dataset.return_value = mock_dataset_attributes mock_trait.return_value = AttributesSetter({"symbol": "", "description_display": "Description", - "title": "research1", "journal": "", "authors": ""}) + "title": "research1", "journal": "", "authors": ""}) results = get_export_metadata("random_id", "Temp") expected = [["Record ID: random_id"], @@ -48,14 +43,13 @@ class TestExportTraits(unittest.TestCase): def test_get_export_metadata_with_publish(self, data_mock, trait_mock): """test for exporting metadata with dataset.type=Publish""" mock_dataset_attributes = AttributesSetter({"type": "Publish", "dataset_name": "Temp", - "name": "Temp", "description_display": "Description goes here"}) + "name": "Temp", "description_display": "Description goes here"}) - mock_nested_attributes = HelperClass() - mock_nested_attributes.name = "name" + mock_nested_attributes = AttributesSetter({"name": "name"}) mock_dataset_attributes.group = mock_nested_attributes data_mock.create_dataset.return_value = mock_dataset_attributes trait_instance = AttributesSetter({"symbol": "", "description_display": "Description", - "title": "research1", "journal": "", "authors": ""}) + "title": "research1", "journal": "", "authors": ""}) trait_mock.return_value = trait_instance results = get_export_metadata( -- cgit v1.2.3