def test_platform_regex(self): """Test for correct platform_regex output""" for key in PLATFORM_FRAGMENTS: scraper = mozdownload.Scraper(destination=self.temp_dir, platform=key) self.assertEqual(scraper.platform_regex, PLATFORM_FRAGMENTS[key])
def test_not_implemented(tmpdir, attr): """test implementations available""" scraper = mozdownload.Scraper(destination=str(tmpdir)) with pytest.raises(errors.NotImplementedError): getattr(scraper, attr) with pytest.raises(errors.NotImplementedError): scraper.build_filename('invalid binary')
def test_notimplementedexceptions(self): scraper = mozdownload.Scraper(destination=self.temp_dir, logger=self.logger) for attr in ['binary', 'binary_regex', 'path_regex']: self.assertRaises(errors.NotImplementedError, getattr, scraper, attr) self.assertRaises(errors.NotImplementedError, scraper.build_filename, 'invalid binary')
def test_notimplementedexceptions(self): scraper = mozdownload.Scraper(directory=self.temp_dir, version=None, log_level='ERROR') for attr in ['binary', 'binary_regex', 'path_regex']: self.assertRaises(mozdownload.NotImplementedError, getattr, scraper, attr) self.assertRaises(mozdownload.NotImplementedError, scraper.build_filename, 'invalid binary')
def test_platform_regex(self): """Test for correct platform_regex output""" for key in mozdownload.PLATFORM_FRAGMENTS: scraper = mozdownload.Scraper(directory=self.temp_dir, version=None, platform=key) self.assertEqual(scraper.platform_regex, mozdownload.PLATFORM_FRAGMENTS[key])
def test_platform_regex(tmpdir, platform_key, platform_value): """Test for correct platform_regex output""" scraper = mozdownload.Scraper(destination=str(tmpdir), platform=platform_key) assert scraper.platform_regex == platform_value