'Tests that we can create aff4 objects using a pool.'

def testCreateWithPool(self):

    path1 = 'aff4:/test/pool_memory_stream'
    path2 = 'aff4:/test/pool_memory_stream2'
    pool = data_store.DB.GetMutationPool(token=self.token)
    for path in [path1, path2]:
        fd = aff4.FACTORY.Create(path, aff4.AFF4UnversionedMemoryStream, mode='w', mutation_pool=pool, token=self.token)
        content = ('TestData' * 10)
        fd.Write(content)
        fd.Close()
    for path in [path1, path2]:
        for subject in data_store.DB.subjects:
            self.assertNotIn(path, subject)
    pool.Flush()
    for path in [path1, path2]:
        for subject in data_store.DB.subjects:
            if (path in subject):
                break
        else:
            self.fail(('Nothing    was    written    to    the    test    path    (%s)' % path))
    fd = aff4.FACTORY.Open(path1, token=self.token)
    self.assertEqual(fd.read(100), content)
