'Assert that a Connector is constructed from a Config properly.'

def assertConnectorState(self):

    mc = connector.Connector.from_config(self.config)
    self.assertEqual(mc.address, self.config['mainAddress'])
    self.assertIsInstance(mc.doc_managers[0], doc_manager_simulator.DocManager)
    pwfile = self.config['authentication.passwordFile']
    if pwfile:
        with open(pwfile, 'r') as fd:
            test_password = re.sub('\\s', '', fd.read())
            self.assertEqual(mc.auth_key, test_password)
    self.assertEqual(mc.auth_username, self.config['authentication.adminUsername'])
    self.assertEqual(mc.oplog_checkpoint, self.config['oplogFile'])
    self.assertEqual(mc.tz_aware, self.config['timezoneAware'])
    self.assertEqual(mc.ssl_kwargs.get('ssl_certfile'), self.config['ssl.sslCertfile'])
    self.assertEqual(mc.ssl_kwargs.get('ssl_ca_certs'), self.config['ssl.sslCACerts'])
    self.assertEqual(mc.ssl_kwargs.get('ssl_keyfile'), self.config['ssl.sslKeyfile'])
    self.assertEqual(mc.ssl_kwargs.get('ssl_cert_reqs'), self.config['ssl.sslCertificatePolicy'])
    command_helper = mc.doc_managers[0].command_helper
    for name in self.config['namespaces.mapping']:
        self.assertTrue(command_helper.namespace_config.map_namespace(name))
    log_levels = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]
    test_logger = setup_logging(self.config)
    self.assertEqual(log_levels[self.config['verbosity']], test_logger.level)
    test_handlers = [h for h in test_logger.handlers if isinstance(h, logging.handlers.TimedRotatingFileHandler)]
    self.assertEqual(len(test_handlers), 1)
    test_handler = test_handlers[0]
    expected_handler = logging.handlers.TimedRotatingFileHandler('test-dummy.log', when=self.config['logging.rotationWhen'], interval=self.config['logging.rotationInterval'], backupCount=self.config['logging.rotationBackups'])
    self.assertEqual(test_handler.when, expected_handler.when)
    self.assertEqual(test_handler.backupCount, expected_handler.backupCount)
    self.assertEqual(test_handler.interval, expected_handler.interval)
    ot_kwargs = mc.kwargs
    self.assertEqual(ot_kwargs['ns_set'], self.config['namespaces.include'])
    self.assertEqual(ot_kwargs['collection_dump'], (not self.config['noDump']))
    self.assertEqual(ot_kwargs['gridfs_set'], self.config['namespaces.gridfs'])
    self.assertEqual(ot_kwargs['continue_on_error'], self.config['continueOnError'])
    self.assertEqual(ot_kwargs['fields'], self.config['fields'])
    self.assertEqual(ot_kwargs['batch_size'], self.config['batchSize'])
    for (dm, dm_expected) in zip(mc.doc_managers, self.config['docManagers']):
        self.assertEqual(dm.kwargs, dm_expected.kwargs)
        self.assertEqual(dm.auto_commit_interval, dm_expected.auto_commit_interval)
        self.assertEqual(dm.url, dm_expected.url)
        self.assertEqual(dm.chunk_size, dm_expected.chunk_size)
