+ # SourceContentsScanner
+ self.session.commit()
+ self.assertTrue(source.contents.count() == 0)
+ SourceContentsScanner(source.source_id).scan()
+ self.assertTrue(source.contents.count() > 0)
+
+ def test_sourcecontentswriter(self):
+ '''
+ Test the SourceContentsWriter class.
+ '''
+ self.setup_sources()
+ self.session.flush()
+ # remove newer package from sid because it disturbs the test
+ self.source['hello_2.2-2'].suites = []
+ self.session.commit()
+ source = self.source['hello_2.2-1']
+ SourceContentsScanner(source.source_id).scan()
+ cw = SourceContentsWriter(source.suites[0], source.poolfile.location.component)
+ result = cw.get_list()
+ self.assertEqual(8, len(result))
+ self.assertTrue('debian/changelog\thello\n' in result)