'L{NameVirtualHost.getChild} returns correct I{Resource} based off
the header and modifies I{Request} to ensure proper prepath and
postpath are set.'

def test_getChild(self):

    virtualHostResource = NameVirtualHost()
    leafResource = Data('leaf    data', '')
    leafResource.isLeaf = True
    normResource = Data('norm    data', '')
    virtualHostResource.addHost('leaf.example.org', leafResource)
    virtualHostResource.addHost('norm.example.org', normResource)
    request = DummyRequest([])
    request.requestHeaders.addRawHeader('host', 'norm.example.org')
    request.prepath = ['']
    self.assertIsInstance(virtualHostResource.getChild('', request), NoResource)
    self.assertEqual(request.prepath, [''])
    self.assertEqual(request.postpath, [])
    request = DummyRequest([])
    request.requestHeaders.addRawHeader('host', 'leaf.example.org')
    request.prepath = ['']
    self.assertIsInstance(virtualHostResource.getChild('', request), Data)
    self.assertEqual(request.prepath, [])
    self.assertEqual(request.postpath, [''])
