+ location.files.remove(self.file['sl'])
+ # TODO: deletion should cascade automatically
+ self.session.delete(self.file['sl'])
+ self.session.refresh(location)
+ self.assertEqual(1, location.files.count())
+ # please note that we intentionally do not specify 'location' here
+ self.file['sl'] = PoolFile(filename = 'main/s/sl/sl_3.03-16.dsc', \
+ filesize = 0, md5sum = '')
+ location.files.append(self.file['sl'])
+ self.session.refresh(location)
+ self.assertEqual(2, location.files.count())