# XXX currently, packages are not deleted
#self.assertFalse(os.path.exists(package.path))
+ async def test_files(self):
+ """
+ Tests whether the filelist could be loaded correctly
+ """
+ path = self.source_path("tests/data/beep-1.3-2.ip3.x86_64.pfm")
+
+ # Create the package
+ with self.db.transaction():
+ package = await self._create_package(path)
+
+ # Check if the filelist is of the correct type
+ self.assertIsInstance(package.files, list)
+ for file in package.files:
+ self.assertIsInstance(file, packages.File)
+
+ # Check if we have the correct paths
+ self.assertIn("/usr/bin/beep", [file.path for file in package.files])
+
+ # Fetch a specific file
+ file = package.get_file("/usr/bin/beep")
+ self.assertIsInstance(file, packages.File)
+
+ # Try to read a file
+ payload = await file.get_payload()
+ self.assertIsInstance(payload, bytes)
+
if __name__ == "__main__":
unittest.main()