Exemplo n.º 1
0
 def test_e_data_provider(self):
     data_providers = parse_config(["oeda", "config", "crowdnav_config"],
                                   "dataProviders")
     self.assertTrue(data_providers)
     for dp in data_providers:
         self.assertTrue(dp["type"])
         self.assertTrue(dp["serializer"])
         createInstance(wf=None, cp=dp)
         self.assertTrue(dp["instance"])
         dp["instance"] = None
     UnitTest.data_providers = data_providers
Exemplo n.º 2
0
 def test_a_db_1(self):
     config = parse_config(["oeda", "databases"], "experiment_db_config")
     self.assertTrue(config)
     self.assertTrue(config["host"])
     self.assertTrue(config["port"])
     self.assertTrue(config["index"]["name"])
     UnitTest.elasticsearch_index = config["index"]["name"] + "_test"
     UnitTest.elasticsearch_ip = str(config["host"])
     UnitTest.elasticsearch_port = str(config["port"])
     setup_experiment_database("elasticsearch",
                               UnitTest.elasticsearch_ip,
                               UnitTest.elasticsearch_port,
                               for_tests=True)
     self.assertTrue(db())
Exemplo n.º 3
0
 def test_g_default_variables(self):
     default_variables = parse_config(["oeda", "config", "crowdnav_config"],
                                      "knobs")
     self.assertTrue(default_variables)
     # integrity check
     for var in default_variables:
         self.assertTrue(var["name"])
         self.assertTrue(var["description"])
         self.assertTrue(var["scale"])
         self.assertTrue(
             type(var["min"]) is float or type(var["min"]) is int)
         self.assertTrue(
             type(var["max"]) is float or type(var["min"]) is int)
         self.assertTrue(
             type(var["default"]) is float or type(var["min"]) is int)
Exemplo n.º 4
0
    def test_f_considered_data_types(self):
        data_providers = parse_config(["oeda", "config", "crowdnav_config"],
                                      "dataProviders")
        self.assertTrue(data_providers)
        # integrity check
        for dp in data_providers:
            self.assertTrue(dp["name"])
            self.assertTrue(dp["description"])
            self.assertTrue(dp["type"])
            self.assertTrue(dp["serializer"])
            self.assertTrue(dp["incomingDataTypes"])
            for dt in dp["incomingDataTypes"]:
                self.assertTrue(dt["name"])
                self.assertTrue(dt["description"])
                self.assertTrue(dt["scale"])
                self.assertTrue(dt["dataProviderName"])
                self.assertTrue(dt["criteria"])

            if dp["name"] == "Trips":
                considered_data_types = adjust_functions_and_weights(
                    dp["incomingDataTypes"])
                self.assertTrue(considered_data_types)
                UnitTest.considered_data_types = considered_data_types