diff --git a/Exareme-Docker/src/mip-algorithms/tests/__init__.py b/Exareme-Docker/src/mip-algorithms/tests/__init__.py index 8fb2ad3540579b14473f2cfccece906309191330..6c720a1516349862ffbe266f7a88d41e1201669e 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/__init__.py +++ b/Exareme-Docker/src/mip-algorithms/tests/__init__.py @@ -1 +1,16 @@ vm_url = "http://88.197.53.100:9090/mining/query/" + +anova_url = vm_url + "ANOVA" +cart_url = vm_url + "CART" +histograms_url = vm_url + "HISTOGRAMS" +id3_url = vm_url + "ID3" +kmeans_url = vm_url + "KMEANS" +linear_regression_url = vm_url + "LINEAR_REGRESSION" +multiple_histograms_url = vm_url + "MULTIPLE_HISTOGRAMS" +cross_validation_url = vm_url + "CROSS_VALIDATION_K_FOLD" +naive_bayes_training_url = vm_url + "NAIVE_BAYES_TRAINING" +naive_bayes_testing_url = vm_url + "NAIVE_BAYES_TESTING" +naive_bayes_training_standalone_url = vm_url + "NAIVE_BAYES_TRAINING_STANDALONE" +ttest_independent_url = vm_url + "TTEST_INDEPENDENT" +ttest_onesample_url = vm_url + "TTEST_ONESAMPLE" +ttest_paired_url = vm_url + "TTEST_PAIRED" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ANOVA.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ANOVA.py index d6cf005ffb94bbe2f38dcfac06254ae2ddc87502..456d33185678bd4c8b03424f440cc155fae00a07 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ANOVA.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ANOVA.py @@ -10,11 +10,8 @@ import rpy2.robjects as robjects import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url - -endpointUrl = vm_url + "ANOVA" +from tests import anova_url as endpointUrl folderPath = "R_scripts" file = "ANOVA.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_Cart.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_Cart.py index fe68ef56a347ec8bc755ffe9ed5370e7ada5a99c..0e790c1a70634f5c7d7f021dfba83a09aa7a8cb6 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_Cart.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_Cart.py @@ -21,9 +21,8 @@ from scipy import stats from os import path sys.path.append(path.abspath(__file__)) +from tests import cart_url as endpointUrl_CartTraining -from tests import vm_url -endpointUrl_CartTraining= vm_url + 'CART' #endpointUrl_CartPredict= vm_url + 'CART_PREDICT' path = '../data/dementia/' diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_Histograms.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_Histograms.py index aa96f53a354ec5ffaf39db742bbfe8f3f84d5738..cd8b6ec05eaf1d03443503b6cb086e4d5a6842ab 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_Histograms.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_Histograms.py @@ -10,11 +10,9 @@ import rpy2.robjects as robjects import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url +from tests import histograms_url as endpointUrl -endpointUrl = vm_url + "HISTOGRAMS" folderPath = "R_scripts" file = "Histograms.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ID3.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ID3.py index ff5400181ba8d8e30c4bc5d118adfe7295096282..c3d6ac0ae972b037d54ccb4f13aa3ea54cb113b2 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ID3.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ID3.py @@ -5,11 +5,8 @@ import re import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url - -endpointUrl = vm_url + "ID3" +from tests import id3_url as endpointUrl def test_ID3_1(): diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_KMEANS.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_KMEANS.py index b72440dbcfb4a4d46fffda56686afcdab6431740..8eefd850d0bed2fb68dce30fbb3d21d0b1f124a3 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_KMEANS.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_KMEANS.py @@ -10,11 +10,9 @@ import rpy2.robjects as robjects import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url +from tests import kmeans_url as endpointUrl -endpointUrl = vm_url + "KMEANS" folderPath = "R_scripts" file = "kMeans.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_LinearRegression.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_LinearRegression.py index 5d2ac66e28a5c5d88ac2ed4b50e9645c6e172332..4d4534ab5b0db4983768f84efcba1b7ff01c06f7 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_LinearRegression.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_LinearRegression.py @@ -11,11 +11,9 @@ import rpy2.robjects as robjects import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url +from tests import linear_regression_url as endpointUrl -endpointUrl = vm_url + "LINEAR_REGRESSION" folderPath = "R_scripts" file = "LinearRegression.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_MultipleHistograms.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_MultipleHistograms.py index 572f581b0e07795eace81ab0e4674a4b8fd9b2f6..af4d58ab2cf7ec06f921a179a3e6339a3707cf6a 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_MultipleHistograms.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_MultipleHistograms.py @@ -10,11 +10,9 @@ import rpy2.robjects as robjects import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url +from tests import multiple_histograms_url as endpointUrl -endpointUrl = vm_url + "MULTIPLE_HISTOGRAMS" folderPath = "R_scripts" file = "MultipleHistograms.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_NaiveBayes.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_NaiveBayes.py index 4c42080ffe03d58dd070031b63b1bc88f2f5a154..e502f258bb8c5e82bf15a46be6c47c735064fc78 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_NaiveBayes.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_NaiveBayes.py @@ -6,13 +6,10 @@ from decimal import * import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url - -url1 = vm_url + "CROSS_VALIDATION_K_FOLD" -url2 = vm_url + "NAIVE_BAYES_TRAINING" -url3 = vm_url + "NAIVE_BAYES_TESTING" +from tests import cross_validation_url as url1 +from tests import naive_bayes_training_url as url2 +from tests import naive_bayes_testing_url as url3 def test_NAIVEBAYES_1(): diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_NaiveBayes_Training_Standalone.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_NaiveBayes_Training_Standalone.py index d85c855fe67b3185ff1139aaa7377f90442a4431..61137714ce4dc1a8f9aa83f7350d5878ec016eea 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_NaiveBayes_Training_Standalone.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_NaiveBayes_Training_Standalone.py @@ -11,11 +11,9 @@ import rpy2.robjects as robjects import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url +from tests import naive_bayes_training_standalone_url as endpointUrl -endpointUrl = vm_url + "NAIVE_BAYES_TRAINING_STANDALONE" folderPath = "R_scripts" file = "NaiveBayes_Training_Standalone.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_independent.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_independent.py index 9347317fb80b23dc2cb5abbc3db181857193ac96..e422fe832582840cf2bda8bd8c0e3a511af6d399 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_independent.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_independent.py @@ -10,11 +10,9 @@ import rpy2.robjects as robjects import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url +from tests import ttest_independent_url as endpointUrl -endpointUrl = vm_url + "TTEST_INDEPENDENT" folderPath = "R_scripts" file = "ttest_independent.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_onesample.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_onesample.py index 46753e3e5c41b8cce5c9d236155e09f23bcb5d9c..b6bbe74f7145af36d6b9e2e2f7884e2e9eb3a62f 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_onesample.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_onesample.py @@ -8,14 +8,11 @@ from decimal import * import rpy2.robjects as robjects - import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url +from tests import ttest_onesample_url as endpointUrl -endpointUrl = vm_url + "TTEST_ONESAMPLE" folderPath = "R_scripts" file = "ttest_onesample.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_paired.py b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_paired.py index 49c3450c8659943ab55aff39a40e883e4d01ac25..54c5b7bbc79d9ac668bbc30ac23faf4eed14a34d 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_paired.py +++ b/Exareme-Docker/src/mip-algorithms/tests/algorithm_tests_with_privacy/test_ttest_paired.py @@ -10,11 +10,9 @@ import rpy2.robjects as robjects import sys from os import path - sys.path.append(path.abspath(__file__)) -from tests import vm_url +from tests import ttest_paired_url as endpointUrl -endpointUrl = vm_url + "TTEST_PAIRED" folderPath = "R_scripts" file = "ttest_paired.Rmd" diff --git a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_missingDataset.py b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_missingDataset.py index 25ac28bca747c20f244231049619e11810456116..cc9ec5a213e71e2850b6a20dcb0cdbe1b9eed8fe 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_missingDataset.py +++ b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_missingDataset.py @@ -5,9 +5,7 @@ import logging import sys sys.path.insert(0, "../") -from tests import vm_url - -endpointUrl = vm_url + "LINEAR_REGRESSION" +from tests import linear_regression_url as endpointUrl def test_LINEAR_REGRESSION(): diff --git a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_missingPathology.py b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_missingPathology.py index 5c75907b4397fe77ccbca6e9910cc8213bcf7b01..327768c0bdcdd556e0ec89b0004d496dccbb838c 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_missingPathology.py +++ b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_missingPathology.py @@ -5,9 +5,7 @@ import logging import sys sys.path.insert(0, "../") -from tests import vm_url - -endpointUrl = vm_url + "LINEAR_REGRESSION" +from tests import linear_regression_url def test_LINEAR_REGRESSION(): @@ -22,7 +20,7 @@ def test_LINEAR_REGRESSION(): {"name": "filter", "value": ""}, ] headers = {"Content-type": "application/json", "Accept": "text/plain"} - r = requests.post(endpointUrl, data=json.dumps(data), headers=headers) + r = requests.post(linear_regression_url, data=json.dumps(data), headers=headers) result = json.loads(r.text) check_result(r.text) diff --git a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_parameters.py b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_parameters.py index fbd534d60cfa216285b73d70200cd60000b3661c..a5c9bbcef08daa0297dcef5cce0fee8e5a091a36 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_parameters.py +++ b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_parameters.py @@ -5,14 +5,13 @@ import logging import sys sys.path.insert(0, "../") -from tests import vm_url - +from tests import ttest_paired_url +from tests import linear_regression_url +from tests import anova_url def test_parameter_modulo2(): - endpointUrl1 = vm_url + "TTEST_PAIRED" - logging.info("---------- TEST : t-test input parameters throwing error.") data = [ {"name": "y", "value": "lefthippocampus-righthippocampus,leftententorhinalarea"}, @@ -22,7 +21,7 @@ def test_parameter_modulo2(): {"name": "filter", "value": ""}, ] headers = {"Content-type": "application/json", "Accept": "text/plain"} - r = requests.post(endpointUrl1, data=json.dumps(data), headers=headers) + r = requests.post(ttest_paired_url, data=json.dumps(data), headers=headers) result = json.loads(r.text) assert(result["result"][0]["data"]==" The input should be in the form of y1-y2,y3-y4,.. Therefore the number of variables should be modulo 2 ") assert(result["result"][0]["type"]=="text/plain+user_error") @@ -31,8 +30,6 @@ def test_parameter_modulo2(): def test_valueEnumerationsParameter(): - endpointUrl1 = vm_url + "LINEAR_REGRESSION" - logging.info("---------- TEST : valueEnumerations throwing error.") data = [ {"name": "x", "value": "alzheimerbroadcategory*gender*brainstem*opticchiasm"}, @@ -44,7 +41,7 @@ def test_valueEnumerationsParameter(): {"name": "filter", "value": ""}, ] headers = {"Content-type": "application/json", "Accept": "text/plain"} - r = requests.post(endpointUrl1, data=json.dumps(data), headers=headers) + r = requests.post(linear_regression_url, data=json.dumps(data), headers=headers) result = json.loads(r.text) assert ( r.text @@ -54,8 +51,6 @@ def test_valueEnumerationsParameter(): def test_parameter_max_value(): - endpointUrl = vm_url + "ANOVA" - logging.info("---------- TEST : Algorithms for User Error") data = [ {"name": "iterations_max_number", "value": "20"}, @@ -68,7 +63,7 @@ def test_parameter_max_value(): {"name": "outputformat", "value": "pfa"}, ] headers = {"Content-type": "application/json", "Accept": "text/plain"} - r = requests.post(endpointUrl, data=json.dumps(data), headers=headers) + r = requests.post(anova_url, data=json.dumps(data), headers=headers) result = json.loads(r.text) assert ( diff --git a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_privacy.py b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_privacy.py index 1872d3547de0a712a1e0c26043efa42b71fb3c80..d67cc65fb53981c95e20532aefdd6783979cbdb2 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_privacy.py +++ b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_privacy.py @@ -4,30 +4,19 @@ import logging import unittest import requests -from tests.algorithm_tests_with_privacy.test_ANOVA import endpointUrl as url_anova +from tests import anova_url as url_anova +from tests import histograms_url as url_hist +from tests import id3_url as url_id3 +from tests import kmeans_url as url_kmeans +from tests import linear_regression_url as url_linreg +from tests import multiple_histograms_url as url_multi_hist +from tests import cross_validation_url as url1 +from tests import naive_bayes_training_standalone_url as url_naive_bayes_standalone +from tests import ttest_independent_url as url_ttest_indep +from tests import ttest_onesample_url as url_ttest_onesample +from tests import ttest_paired_url as url_ttest_paired + from tests import vm_url -from tests.algorithm_tests_with_privacy.test_Histograms import endpointUrl as url_hist -from tests.algorithm_tests_with_privacy.test_ID3 import endpointUrl as url_id3 -from tests.algorithm_tests_with_privacy.test_KMEANS import endpointUrl as url_kmeans -from tests.algorithm_tests_with_privacy.test_LinearRegression import ( - endpointUrl as url_linreg, -) -from tests.algorithm_tests_with_privacy.test_MultipleHistograms import ( - endpointUrl as url_multi_hist, -) -from tests.algorithm_tests_with_privacy.test_NaiveBayes import url1 -from tests.algorithm_tests_with_privacy.test_NaiveBayes_Training_Standalone import ( - endpointUrl as url_naive_bayes_standalone, -) -from tests.algorithm_tests_with_privacy.test_ttest_independent import ( - endpointUrl as url_ttest_indep, -) -from tests.algorithm_tests_with_privacy.test_ttest_onesample import ( - endpointUrl as url_ttest_onesample, -) -from tests.algorithm_tests_with_privacy.test_ttest_paired import ( - endpointUrl as url_ttest_paired, -) url_calibration = vm_url + "CALIBRATION_BELT" url_pearson = vm_url + "PEARSON_CORRELATION" diff --git a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_wrongDataset.py b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_wrongDataset.py index ece5dbfe1c6225616cccbd94adf96508e4c7ff90..bfde57d81e35441c93f708868d8deb2b924f975e 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_wrongDataset.py +++ b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_wrongDataset.py @@ -5,9 +5,7 @@ import logging import sys sys.path.insert(0, "../") -from tests import vm_url - -endpointUrl = vm_url + "LINEAR_REGRESSION" +from tests import linear_regression_url as endpointUrl def test_LINEAR_REGRESSION(): diff --git a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_wrongPathology.py b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_wrongPathology.py index 9b7892334ed62375bbc05bbebf086144aec4cbe6..614b1c71cd496475d7646a34fadb3e40a4d4d587 100644 --- a/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_wrongPathology.py +++ b/Exareme-Docker/src/mip-algorithms/tests/exareme_tests/test_wrongPathology.py @@ -5,9 +5,7 @@ import logging import sys sys.path.insert(0, "../") -from tests import vm_url - -endpointUrl = vm_url + "LINEAR_REGRESSION" +from tests import linear_regression_url as endpointUrl def test_LINEAR_REGRESSION():