def test_gecko_driver_with_wrong_token():
    with pytest.raises(ValueError) as ex:
        driver = GeckoDriver(version="latest",
                             os_type="linux32")
        driver.config.set("gh_token", "adasda")
        cache.download_driver(driver)
    assert ex.value.args[0]['message'] == "Bad credentials"
Example #2
0
    def __init__(self, version=None, os_type=utils.os_type()):
        # type: (str, str) -> GeckoDriverManager
        super(GeckoDriverManager, self).__init__()
        if os_type.startswith("mac"):
            os_type = "macos"

        self.driver = GeckoDriver(version=version,
                                  os_type=os_type)
Example #3
0
def test_can_download_firefox_driver(os_type):
    delete_cache()
    name = "geckodriver"
    version = "v0.11.1"
    driver = GeckoDriver(version=version,
                         os_type=os_type)

    binary = cache.download_driver(driver)
    assert binary.name == name
Example #4
0
def test_gecko_driver_with_wrong_token():
    old_token = os.getenv("GH_TOKEN", "default")
    os.environ["GH_TOKEN"] = "aaa"
    with pytest.raises(ValueError) as ex:
        driver = GeckoDriver(version="latest",
                             os_type="linux32")
        cache.download_driver(driver)
    assert ex.value.args[0]['message'] == "Bad credentials"
    os.environ["GH_TOKEN"] = old_token
Example #5
0
    def __init__(self, version="latest",
                 os_type=utils.os_type(),
                 path=None,
                 name="geckodriver",
                 url="https://github.com/mozilla/geckodriver/releases/download",
                 latest_release_url="https://api.github.com/repos/mozilla/geckodriver/releases/latest",
                 mozila_release_tag="https://api.github.com/repos/mozilla/geckodriver/releases/tags/{0}"):
        super(GeckoDriverManager, self).__init__(path)

        self.driver = GeckoDriver(version=version,
                                  os_type=os_type,
                                  name=name,
                                  url=url,
                                  latest_release_url=latest_release_url,
                                  mozila_release_tag=mozila_release_tag)
Example #6
0
    def __init__(self, version="latest",
                 os_type=utils.os_type(),
                 path=None,
                 name="geckodriver",
                 url="https://github.com/mozilla/geckodriver/releases/download",
                 latest_release_url="https://api.github.com/repos/mozilla/geckodriver/releases/latest",
                 mozila_release_tag="https://api.github.com/repos/mozilla/geckodriver/releases/tags/{0}",
                 log_level=logging.INFO,
                 print_first_line=True,
                 cache_valid_range=1):
        super(GeckoDriverManager, self).__init__(path, log_level, print_first_line, cache_valid_range)

        self.driver = GeckoDriver(version=version,
                                  os_type=os_type,
                                  name=name,
                                  url=url,
                                  latest_release_url=latest_release_url,
                                  mozila_release_tag=mozila_release_tag)
Example #7
0
 def __init__(self, version=None, os_type=utils.os_name()):
     # type: (str, str) -> GeckoDriverManager
     super(GeckoDriverManager, self).__init__()
     self.driver = GeckoDriver(version=version, os_type=os_type)
Example #8
0
 def __init__(self, version=None, os_type=utils.os_name()):
     DriverManager.__init__(self)
     self.driver = GeckoDriver(version=version, os_type=os_type)