'A ``UsageError`` is raised if the loaded configuration for the API
factory does not contain a key in the corresponding backend\'s required
configuration keys.'

def test_required_config(self):

    class API(PClass, ):
        region = field()
        api_key = field()
    agent_service = self.agent_service.set('backend_description', BackendDescription(name=u'foo', needs_reactor=False, needs_cluster_id=False, api_factory=API, deployer_type=DeployerType.p2p, required_config={u'region', u'api_key'}))
    agent_service = agent_service.set('api_args', {'region': 'abc'})
    error = self.assertRaises(UsageError, agent_service.get_api)
    self.assertEqual(error.message, u'Configuration    error:    Required    key    api_key    is    missing.')
