def test_extraction_with_filter_conf(self, mock_columns, mock_tables,
                                         mock_keyspaces):
        # type: () -> None
        mock_keyspaces.return_value = {'test_schema': None}
        mock_tables.return_value = {'test_table': None}
        columns_dict = OrderedDict()
        columns_dict['id'] = CassandraColumnMetadata(None, 'id', 'int')
        columns_dict['txt'] = CassandraColumnMetadata(None, 'txt', 'text')
        mock_columns.return_value = columns_dict

        def filter_function(k, t):
            return False if 'test' in k or 'test' in t else False

        conf = ConfigFactory.from_dict(
            {CassandraExtractor.FILTER_FUNCTION_KEY: filter_function})

        extractor = CassandraExtractor()
        extractor.init(conf)
        self.assertIsNone(extractor.extract())
    def test_extraction_with_default_conf(self, mock_columns, mock_tables,
                                          mock_keyspaces):
        # type: () -> None
        mock_keyspaces.return_value = {'test_schema': None}
        mock_tables.return_value = {'test_table': None}
        columns_dict = OrderedDict()
        columns_dict['id'] = CassandraColumnMetadata(None, 'id', 'int')
        columns_dict['txt'] = CassandraColumnMetadata(None, 'txt', 'text')
        mock_columns.return_value = columns_dict

        extractor = CassandraExtractor()
        extractor.init(self.default_conf)
        actual = extractor.extract()
        expected = TableMetadata('cassandra', 'gold', 'test_schema',
                                 'test_table', None, [
                                     ColumnMetadata('id', None, 'int', 0),
                                     ColumnMetadata('txt', None, 'text', 1)
                                 ])
        self.assertEqual(expected.__repr__(), actual.__repr__())
        self.assertIsNone(extractor.extract())