backref=backref('binaries', lazy='dynamic')),
extra_sources = relation(DBSource, secondary=self.tbl_extra_src_references,
backref=backref('extra_binary_references', lazy='dynamic')),
- key = relation(BinaryMetadata,
+ key = relation(BinaryMetadata, cascade='all',
collection_class=attribute_mapped_collection('key'))),
extension = validator)
suites = relation(Suite, secondary=self.tbl_src_associations,
backref=backref('sources', lazy='dynamic')),
srcuploaders = relation(SrcUploader),
- key = relation(SourceMetadata,
+ key = relation(SourceMetadata, cascade='all',
collection_class=attribute_mapped_collection('key'))),
extension = validator)
self.assertEqual('http://debian.org', self.src_hello.metadata[self.homepage])
self.assertTrue(self.depends not in self.src_hello.metadata)
+ def test_delete(self):
+ '''
+ Tests the delete / cascading behaviour.
+ '''
+ self.setup_metadata()
+ self.session.delete(self.bin_hello)
+ # Remove associated binaries because we have no cascading rule for
+ # them.
+ for binary in self.src_hello.binaries:
+ self.session.delete(binary)
+ self.session.delete(self.src_hello)
+ self.session.flush()
+
if __name__ == '__main__':
unittest.main()