'``AgentService.get_api`` returns an object constructed by the
factory corresponding to the agent\'s ``backend_description``,
supplying ``api_args``.'

def test_backend_selection(self):

    class API(PClass, ):
        a = field()
        b = 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)).set('api_args', {'a': 'x', 'b': 'y'})
    api = agent_service.get_api()
    self.assertEqual(API(a='x', b='y'), api)
