'Flush with age policy NEWEST_TIME should only keep a single version.'

def testFlushNewestTime(self):

    obj = aff4.FACTORY.Create('foobar', aff4.AFF4Object, token=self.token)
    obj.Set(obj.Schema.STORED('www.google.com'))
    obj.Close()
    obj = aff4.FACTORY.Open('foobar', mode='rw', token=self.token, age=aff4.NEWEST_TIME)
    self.assertEqual(1, len(obj.synced_attributes[obj.Schema.STORED.predicate]))
    for i in range(5):
        obj.AddAttribute(obj.Schema.STORED(('example.com/%s' % i)))
    self.assertEqual(5, len(obj.new_attributes[obj.Schema.STORED.predicate]))
    obj.Flush()
    self.assertEqual({}, obj.new_attributes)
    self.assertEqual(1, len(obj.synced_attributes[obj.Schema.STORED.predicate]))
    self.assertEqual(obj.Get(obj.Schema.STORED), 'example.com/4')
