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_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_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_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_groupByClauses(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() groupByClauses = GroupByClauses(configInstance) composer = Composer(TEST_CONFIG_PATH_BASE) self.assertEqual(composer.groupByClauses.clauses, groupByClauses.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))