Esempio n. 1
0
    def test_load_ini_staplesdata_off(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'staples_data_off.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests()

        self.assertTrue(not x)
Esempio n. 2
0
    def test_load_ini_bigquery_sql(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'bigquery_sql.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests()

        test1 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY, 'logical.calcs.bigquery_sql', 'cast_calcs.bigquery_sql.tds', '', 'logicaltests/setup/calcs/setup.*.bigquery_sql.xml', test_config.dsname)

        test2 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY, 'logical.staples.bigquery_sql', 'Staples.bigquery_sql.tds', 'Filter.Trademark', 'logicaltests/setup/staples/setup.*.bigquery_sql.xml', test_config.dsname)

        test3 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY, 'logical.lod.bigquery_sql', 'Staples.bigquery_sql.tds', '', 'logicaltests/setup/lod/setup.*.bigquery_sql.xml', test_config.dsname)

        test4 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY, 'expression.standard.bigquery_sql', 'cast_calcs.bigquery_sql.tds', 'string.ascii,string.char,string.bind_trim,string.left.real,string.right.real,dateparse,math.degree,math.radians,cast.str,cast.int.nulls,logical', 'exprtests/standard/setup.*.txt', test_config.dsname)

        test5 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY, 'expression_test_dates.bigquery_sql', 'cast_calcs.bigquery_sql_dates.tds', 'string.ascii,string.char,string.bind_trim,string.left.real,string.right.real,dateparse,math.degree,math.radians,cast.str,cast.int.nulls', 'exprtests/standard/', test_config.dsname)

        test6 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY, 'expression_test_dates2.bigquery_sql', 'cast_calcs.bigquery_sql_dates2.tds', 'string.ascii,string.char,string.bind_trim,string.left.real,string.right.real,dateparse,math.degree,math.radians,cast.str,cast.int.nulls', 'exprtests/standard/', test_config.dsname)

        test7 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY, 'expression.lod.bigquery_sql', 'cast_calcs.bigquery_sql.tds', '', 'exprtests/lodcalcs/setup.*.txt', test_config.dsname)

        test8 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY, 'logical_test_dates.bigquery_sql', 'cast_calcs.bigquery_sql.tds', '', 'exprtests/standard/setup.*.bigquery_dates.xml', test_config.dsname)

        tests = [test1, test2, test3, test4, test5, test6, test7, test8]

        for test in tests:
            found = [y for y in x if y == test]
            self.assertTrue(found, "[Did not find expected value of [{0}]".format(test))
Esempio n. 3
0
    def test_load_ini(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'aurora.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests()

        test1 = LogicalTestSet('aurora', TEST_DIRECTORY, 'logical.calcs.aurora', 'cast_calcs.aurora.tds', '',
                               'logicaltests/setup/calcs/setup.*.bool_.xml', test_config.dsname)

        test2 = LogicalTestSet('aurora', TEST_DIRECTORY, 'logical.staples.aurora', 'Staples.aurora.tds', 'Filter.Trademark',
                               'logicaltests/setup/staples/setup.*.bool_.xml', test_config.dsname)

        test3 = LogicalTestSet('aurora', TEST_DIRECTORY, 'logical.lod.aurora', 'Staples.aurora.tds', '',
                               'logicaltests/setup/lod/setup.*.bool_.xml', test_config.dsname)

        test4 = ExpressionTestSet('aurora', TEST_DIRECTORY, 'expression.standard.aurora', 'cast_calcs.aurora.tds',
                                  'string.char,dateparse', 'exprtests/standard/setup.*.txt', test_config.dsname)

        test5 = ExpressionTestSet('aurora', TEST_DIRECTORY, 'expression.lod.aurora', 'cast_calcs.aurora.tds', '',
                                  'exprtests/lodcalcs/setup.*.txt', test_config.dsname)

        tests = [test1, test2, test3, test4, test5]

        for test in tests:
            found = [y for y in x if y == test]
            msg = "[Did not find expected value of [{0}]".format(test)
            self.assertTrue(found, msg)
Esempio n. 4
0
 def test_load_run_as_perf_false(self):
     config = configparser.ConfigParser()
     config.read(get_path('tool_test/ini', 'perf_false.ini', __name__))
     test_config = datasource_list.load_test(config, TEST_DIRECTORY)
     self.assertFalse(
         test_config.run_as_perf,
         'run_as_perf did not match: ' + str(test_config.run_as_perf))
Esempio n. 5
0
    def test_load_ini_new_tests(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'new_tests.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests(
        )

        test1 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY,
                               'logical_test1.bigquery_sql_test',
                               'Staples.bigquery.tds', '',
                               'logicaltests/setup.*.bigquery.xml',
                               test_config.dsname)
        test2 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY,
                               'logical_test2.bigquery_sql_test',
                               'Staples.bigquery_sql_test.tds', '',
                               'logicaltests/setup.*.bigquery.xml',
                               test_config.dsname)

        test3 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY,
                                  'expression_test1.bigquery_sql_test',
                                  'cast_calcs.bigquery_sql_dates2.tds',
                                  'string.ascii', 'exprtests/standard/',
                                  test_config.dsname)
        test4 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY,
                                  'expression_test2.bigquery_sql_test',
                                  'cast_calcs.bigquery_sql_test.tds',
                                  'string.char', 'exprtests/standard/',
                                  test_config.dsname)

        tests = [test1, test2, test3, test4]

        for test in tests:
            found = [y for y in x if y == test]
            self.assertTrue(
                found, "[Did not find expected value of [{0}]".format(test))
Esempio n. 6
0
    def test_load_ini_bigquery(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'bigquery.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests(
        )

        test1 = LogicalTestSet(
            test_config.dsname, TEST_DIRECTORY, 'logical.calcs.bigquery',
            'cast_calcs.bigquery.tds', '',
            'logicaltests/setup/calcs/setup.*.bigquery.xml',
            test_config.dsname)

        test2 = LogicalTestSet(
            test_config.dsname, TEST_DIRECTORY, 'logical.staples.bigquery',
            'Staples.bigquery.tds', '',
            'logicaltests/setup/staples/setup.*.bigquery.xml',
            test_config.dsname)

        test3 = ExpressionTestSet(
            test_config.dsname,
            TEST_DIRECTORY,
            'expression.standard.bigquery',
            'cast_calcs.bigquery.tds',
            'string.ascii,string.char,string.bind_trim,string.left.real,string.right.real,dateparse',  # noqa: E501
            'exprtests/standard/setup.*.txt',
            test_config.dsname)

        tests = [test1, test2, test3]

        for test in tests:
            found = [y for y in x if y == test]
            self.assertTrue(
                found, "[Did not find expected value of [{0}]".format(test))
Esempio n. 7
0
    def test_load_ini_missing2(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'aurora_missing2.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests(
        )

        test1 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY,
                               'logical.calcs.aurora', 'cast_calcs.aurora.tds',
                               '',
                               'logicaltests/setup/calcs/setup.*.bool_.xml',
                               test_config.dsname)

        test2 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY,
                               'logical.staples.aurora', 'Staples.aurora.tds',
                               '',
                               'logicaltests/setup/staples/setup.*.bool_.xml',
                               test_config.dsname)

        test3 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY,
                                  'expression.standard.aurora',
                                  'cast_calcs.aurora.tds', '',
                                  'exprtests/standard/setup.*.txt',
                                  test_config.dsname)

        tests = [test1, test2, test3]

        for test in tests:
            found = [y for y in x if y == test]
            self.assertTrue(
                found, "[Did not find expected value of [{0}]".format(test))
Esempio n. 8
0
    def test_load_tabquery_override(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'postgres_jdbc_tabquerytool.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)

        self.assertTrue(test_config.run_time_config.get_tabquery_path("darwin")  == 'tabquerytool_mac')
        self.assertTrue(test_config.run_time_config.get_tabquery_path("linux")  == 'tabquerytool_linux')
        self.assertTrue(test_config.run_time_config.get_tabquery_path("win32")  == 'tabquerytool_windows.exe')
Esempio n. 9
0
    def test_load_ini_logical_config(self):
        config = configparser.ConfigParser()
        #Preserve the case of elements.
        config.optionxform = str
        config.read(get_path('tool_test/ini', 'logical_config.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)

        cfg = test_config.logical_config['my_logical_query']
        self.assertTrue(test_config.logical_config_name == 'my_logical_query')
        self.assertTrue(cfg['tablename'] == 'CRAZYTABLE_$dsName')
        self.assertTrue(cfg['tablePrefix'] == '[LOCO].')
        self.assertTrue(cfg['tablenameUpper'] == 'True')
Esempio n. 10
0
    def test_load_ini_password_file(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'password_file.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests()

        expected_password_file = "a_wrong.password"
        self.assertTrue(len(x) == 10, "[Did not find expected number of tests. Found [{0}]".format(len(x)))
        for test in x:
            actual_file = os.path.split(test.get_password_file_name())[1]
            self.assertTrue(actual_file == expected_password_file,
                            "[Did not find expected value of [{0}, found {1} instead.]".format(expected_password_file, actual_file))  # noqa: E50
Esempio n. 11
0
    def test_load_ini_staplesdata_on(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'staples_data.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests()

        test1 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY, 'expression.staples.bigquery', 'Staples.bigquery.tds', '', 'exprtests/staples/setup.*.txt', test_config.dsname)

        tests = [test1]
        
        for test in tests:
            found = [y for y in x if y == test]
            self.assertTrue(found, "[Did not find expected value of [{0}]".format(test))
Esempio n. 12
0
    def test_load_command_line_override(self):
        config = configparser.ConfigParser()
        config.read(get_path('tool_test/ini', 'override.ini', __name__))
        test_config = datasource_list.load_test(config, TEST_DIRECTORY)
        x = test_config.get_logical_tests() + test_config.get_expression_tests()

        test1 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY, 'logical.calcs.bigquery', 'cast_calcs.bigquery.tds', '', 'logicaltests/setup/calcs/setup.*.bigquery.xml', test_config.dsname)

        test2 = LogicalTestSet(test_config.dsname, TEST_DIRECTORY, 'logical.staples.bigquery', 'Staples.bigquery.tds', '', 'logicaltests/setup/staples/setup.*.bigquery.xml', test_config.dsname)

        test3 = ExpressionTestSet(test_config.dsname, TEST_DIRECTORY, 'expression.standard.bigquery', 'cast_calcs.bigquery.tds', '', 'exprtests/standard/setup.*.txt', test_config.dsname)

        tests = [test1, test2, test3]

        self.assertTrue(test_config.run_time_config.d_override == 'WorkFaster=True Override=TurnOff:yes,TurnOn:no', 'Override did not match: ' + test_config.run_time_config.d_override)

        for test in tests:
            found = [y for y in x if y == test]
            self.assertTrue(found, "[Did not find expected value of [{0}]".format(test))