def test_config(self): configHandlerQuery = ConfigHandlerQuery(self.config) configHandler = ConfigHandlerGroupBy( next(iter(configHandlerQuery().groupby))) configuration = configHandler() self.assertEqual(configHandler.config, configuration)
def test_direction(self): configHandlerQuery = ConfigHandlerQuery(self.config) configuration = configHandlerQuery() groupByClauses = GroupByClauses(configuration) for position, groupByClauseConfig in groupByClauses.clauses.items(): groupByClause = GroupByClause(groupByClauseConfig) self.assertEqual( groupByClause.direction, configuration.groupby[position][ ConfigHandlerGroupBy.DIRECTION])
def test_sort(self): configHandlerQuery = ConfigHandlerQuery(self.config) configuration = configHandlerQuery() groupByClauses = GroupByClauses(configuration) for position, groupByClauseConfig in groupByClauses.clauses.items(): groupByClause = GroupByClause(groupByClauseConfig) self.assertEqual( groupByClause.sort, configuration.groupby[position][ConfigHandlerGroupBy.SORT])
def test_aggregation(self): configHandlerQuery = ConfigHandlerQuery(self.config) configuration = configHandlerQuery() groupByClauses = GroupByClauses(configuration) for position, groupByClauseConfig in groupByClauses.clauses.items(): groupByClause = GroupByClause(groupByClauseConfig) self.assertEqual( groupByClause.aggregation, configuration.groupby[position][ ConfigHandlerGroupBy.DATE_AGGREGATION])
def test_sort(self): configHandlerQuery = ConfigHandlerQuery(self.config) configuration = configHandlerQuery() valueClauses = ValueClauses(configuration) for position, valueClausesConfig in valueClauses.clauses.items(): valueClause = ValueClause(valueClausesConfig) self.assertEqual(valueClause.config, valueClausesConfig) self.assertEqual( valueClause.arrayLimit, configuration.values[position][ConfigHandlerValue.ARRAY_LIMIT])
def test_config(self): configHandlerQuery = ConfigHandlerQuery(self.config) configuration = configHandlerQuery() groupByClauses = GroupByClauses(configuration) for position, groupByClauseConfig in groupByClauses.clauses.items(): groupByClause = GroupByClause(groupByClauseConfig) self.assertEqual(len(groupByClause.config), len(configuration.groupby[position])) self.assertEqual(set(groupByClause.config), set(configuration.groupby[position].values()))
def test_valueClauses(self): TEST_CONFIG_PATH_BASE = os.path.join('config', 'testCase1.json') if not os.path.exists(TEST_CONFIG_PATH_BASE): raise Exception("GroupByField test JSON file not found") config = ConfigurationStub(TEST_CONFIG_PATH_BASE) configHandlerQuery = ConfigHandlerQuery(config()) configInstance = configHandlerQuery() valueClauses = ValueClauses(configInstance) composer = Composer(TEST_CONFIG_PATH_BASE) self.assertEqual(composer.valueClauses.clauses, valueClauses.clauses)
def test_config(self): configHandler = ConfigHandlerQuery(self.config) configuration = configHandler() self.assertEqual(configHandler.config, configuration)
def test_config(self): configHandlerQuery = ConfigHandlerQuery(self.config) valueClauses = ValueClauses(configHandlerQuery()) self.assertEqual(configHandlerQuery.config, valueClauses.config)
def test_clauses(self): configHandlerQuery = ConfigHandlerQuery(self.config) valueClauses = ValueClauses(configHandlerQuery()) self.assertEqual(len(configHandlerQuery().values), len(valueClauses.clauses))
def test_config(self): configHandlerQuery = ConfigHandlerQuery(self.config) groupByClauses = GroupByClauses(configHandlerQuery()) self.assertEqual(configHandlerQuery.config, groupByClauses.config)
def test_clauses(self): configHandlerQuery = ConfigHandlerQuery(self.config) groupByClauses = GroupByClauses(configHandlerQuery()) self.assertEqual(len(configHandlerQuery().values), len(groupByClauses.clauses))
def test_config(self): configHandler = ConfigHandlerQuery(self.config) configuration = configHandler() query = QueryClause(configuration) self.assertEqual(query.config, configHandler.config)
def test_groupby(self): configHandler = ConfigHandlerQuery(self.config) configuration = configHandler() query = QueryClause(configuration) self.assertEqual(query.groupby, self.config[configHandler.GROUPBY])
def test_limit(self): configHandler = ConfigHandlerQuery(self.config) configuration = configHandler() query = QueryClause(configuration) self.assertEqual(query.limit, self.config[configHandler.LIMIT])
def test_values(self): configHandler = ConfigHandlerQuery(self.config) configuration = configHandler() query = QueryClause(configuration) self.assertEqual(query.values, self.config[configHandler.VALUES])
def test_table(self): configHandler = ConfigHandlerQuery(self.config) configuration = configHandler() query = QueryClause(configuration) self.assertEqual(query.table, self.config[configHandler.TABLE])