'Test that non versioned attributes work.'

def testNonVersionedAttribute(self):

    client = aff4.FACTORY.Create(self.client_id, aff4_grr.VFSGRRClient, mode='w', token=self.token)
    client.Set(client.Schema.HOSTNAME('client1'))
    client.Flush()
    client.Set(client.Schema.HOSTNAME('client1'))
    client.Flush()
    client_fd = aff4.FACTORY.Open(self.client_id, age=aff4.ALL_TIMES, token=self.token)
    versions = list(client_fd.GetValuesForAttribute(client_fd.Schema.TYPE))
    self.assertEqual(len(versions), 2)
    client.Set(client.Schema.CLOCK())
    client.Flush()
    client.Set(client.Schema.CLOCK())
    client.Flush()
    client_fd = aff4.FACTORY.Open(self.client_id, age=aff4.ALL_TIMES, token=self.token)
    new_versions = list(client_fd.GetValuesForAttribute(client_fd.Schema.TYPE))
    self.assertEqual(versions, new_versions)
    clocks = list(client_fd.GetValuesForAttribute(client_fd.Schema.CLOCK))
    self.assertEqual(len(clocks), 1)
    self.assertEqual(clocks[0].age, 0)
    fd = aff4.FACTORY.Create('aff4:/foobar', aff4.AFF4Image, token=self.token)
    fd.Set(fd.Schema._CHUNKSIZE(1))
    fd.Set(fd.Schema._CHUNKSIZE(200))
    fd.Set(fd.Schema._CHUNKSIZE(30))
    fd.Flush()
    fd = aff4.FACTORY.Open('aff4:/foobar', mode='rw', token=self.token)
    self.assertEqual(fd.Get(fd.Schema._CHUNKSIZE), 30)
