Ejemplo n.º 1
0
    def test_validate_urls(self) -> None:
        logger = AccumulatingLogger()
        pkg = TestPackage(logger)

        with pkg as maker:
            maker.add_downloads('http://www.valid/', 'https://www.valid/some', 'ftp://ftp.valid/', 'invalid')

        self.assertEqual(pkg.downloads, ['http://www.valid/', 'https://www.valid/some', 'ftp://ftp.valid/'])
        self.assertEqual(len(logger.get()), 1)
        self.assertTrue('invalid' in logger.get()[0])
Ejemplo n.º 2
0
    def test_validate_urls(self):
        logger = AccumulatingLogger()
        factory = PackageFactory(logger)

        maker = factory.begin()
        maker.add_downloads('http://www.valid/', 'https://www.valid/some', 'ftp://ftp.valid/', 'invalid')
        pkg = maker.unwrap()

        self.assertEqual(pkg.downloads, ['http://www.valid/', 'https://www.valid/some', 'ftp://ftp.valid/'])
        self.assertEqual(len(logger.get()), 1)
        self.assertTrue('invalid' in logger.get()[0][0])
Ejemplo n.º 3
0
    def test_ident(self) -> None:
        logger = AccumulatingLogger()

        factory = PackageFactory(logger)

        pkg1 = factory.begin('pkg1')
        pkg1.log('')
        pkg2 = pkg1.clone('pkg2')
        pkg2.log('')
        pkg3 = pkg1.clone(append_ident='pkg3')
        pkg3.log('')

        self.assertTrue('pkg1:' in logger.get()[0])

        self.assertTrue('pkg2:' in logger.get()[1])
        self.assertTrue('pkg1:' not in logger.get()[1])

        self.assertTrue('pkg1pkg3:' in logger.get()[2])
        self.assertTrue('pkg2:' not in logger.get()[2])