How to use the mozregression.utils function in mozregression

To help you get started, we’ve selected a few mozregression examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / mozregression / tests / unit / test_utils.py View on Github external
def test_valid_formatted_release_dates(self):
        formatted_output = utils.formatted_valid_release_dates()
        firefox_releases = utils.releases()

        for line in formatted_output.splitlines():
            if "Valid releases: " in line:
                continue

            fields = line.translate(None, " ").split(":")
            version = int(fields[0])
            date = fields[1]
            self.assertTrue(firefox_releases.has_key(version))
            self.assertEquals(date, firefox_releases[version])
github mozilla / mozregression / tests / unit / test_utils.py View on Github external
def test_url_with_links_regex(self, get):
        get.return_value = Mock(text="""
        
        <a href="thing/">thing</a>
        <a href="thing2/">thing2</a>
        
        """)
        self.assertEquals(
            utils.url_links('', regex="thing2.*"),
            ['thing2/'])
github mozilla / mozregression / tests / unit / test_utils.py View on Github external
def test_valid_release_to_date(self):
        date = utils.date_of_release(8)
        self.assertEquals(date, "2011-08-16")
        date = utils.date_of_release(15)
        self.assertEquals(date, "2012-06-05")
        date = utils.date_of_release(34)
        self.assertEquals(date, "2014-09-02")
github mozilla / mozregression / tests / unit / test_utils.py View on Github external
this is a response.
        """ * (1024 * 16)

        def iter_content(chunk_size=1):
            rest = self.data
            while rest:
                chunk = rest[:chunk_size]
                rest = rest[chunk_size:]
                yield chunk

        response = Mock(headers={'Content-length': str(len(self.data))},
                        iter_content=iter_content)
        get.return_value = response

        fname = os.path.join(self.tempdir, 'some.content')
        utils.download_url('http://toto', fname)

        self.assertEquals(self.data, open(fname).read())
github mozilla / mozregression / tests / unit / test_utils.py View on Github external
def test_url_no_links(self, get):
        get.return_value = Mock(text='')
        self.assertEquals(utils.url_links(''), [])
github mozilla / mozregression / tests / unit / test_utils.py View on Github external
def test_get_http_session(self):
        utils.set_http_cache_session(self.make_cache())
        a_session = utils.get_http_session()

        # verify session exists
        self.assertTrue(isinstance(a_session, requests.Session))

        # turns out CacheControl is just a function not a class
        # so it makes verifying that we're actually using it
        # a little messy
        for k, v in a_session.adapters.items():
            self.assertTrue(isinstance(v.cache, limitedfilecache.LimitedFileCache))
github mozilla / mozregression / tests / unit / test_inboundfinder.py View on Github external
def test_get_app(self):
        argv = ['inboundfinder', '--start-rev=1', '--end-rev=2',]
        actual = inboundfinder.get_build_finder(argv)
        self.assertTrue(isinstance(actual, inboundfinder.BuildsFinder))

        # default is to use a cache session
        a_session = utils.get_http_session()
        self.assertTrue(isinstance(a_session, requests.Session))