def test_latest_build(httpd, tmpdir, args, filename, url):
    """Testing various download scenarios for latest release candidate builds"""

    scraper = ReleaseCandidateScraper(destination=str(tmpdir), base_url=httpd.get_url(), **args)
    expected_filename = os.path.join(str(tmpdir), filename)
    assert scraper.filename == expected_filename
    assert urllib.unquote(scraper.url) == urljoin(httpd.get_url(), url)
def test_build_indices(httpd, tmpdir, args, build_index, build_number, builds):
    """Testing indices in choosing builds for ReleaseCandidateScraper"""

    scraper = ReleaseCandidateScraper(destination=tmpdir,
                                      base_url=httpd.get_url(),
                                      **args)
    assert scraper.build_index == int(build_index)
    assert scraper.build_number == build_number
    assert scraper.builds == builds
Beispiel #3
0
    def test_build_indices(self):
        """Testing indices in choosing builds for ReleaseCandidateScraper"""

        for entry in test_params:
            scraper = ReleaseCandidateScraper(destination=self.temp_dir,
                                              base_url=self.wdir,
                                              logger=self.logger,
                                              **entry['args'])
            self.assertEqual(scraper.build_index, entry['build_index'])
            self.assertEqual(scraper.build_number, entry['build_number'])
            self.assertEqual(scraper.builds, entry['builds'])
Beispiel #4
0
    def test_latest_build(self):
        """Testing various download scenarios for latest release candidate builds"""

        for entry in tests:
            scraper = ReleaseCandidateScraper(destination=self.temp_dir,
                                              base_url=self.wdir,
                                              logger=self.logger,
                                              **entry['args'])
            expected_filename = os.path.join(self.temp_dir, entry['filename'])
            self.assertEqual(scraper.filename, expected_filename)
            self.assertEqual(urllib.unquote(scraper.url),
                             urljoin(self.wdir, entry['url']))
Beispiel #5
0
    def test_scraper(self):
        """Testing various download scenarios for ReleaseCandidateScraper"""

        for entry in tests:
            scraper = ReleaseCandidateScraper(directory=self.temp_dir,
                                              base_url=self.wdir,
                                              log_level='ERROR',
                                              **entry['args'])
            expected_target = os.path.join(self.temp_dir, entry['target'])
            self.assertEqual(scraper.target, expected_target)
            self.assertEqual(urllib.unquote(scraper.final_url),
                             urljoin(self.wdir, entry['target_url']))
Beispiel #6
0
def test_invalid_build_number(httpd, tmpdir):
    """Testing invalid build number when choosing builds for ReleaseCandidateScraper"""

    args = {
        'application': 'firefox',
        'build_number': '2',
        'platform': 'linux',
        'version': '23.0.1'
    }

    with pytest.raises(errors.NotSupportedError):
        ReleaseCandidateScraper(destination=tmpdir,
                                base_url=httpd.get_url(),
                                **args)