def test_should_be_true_for_cached_driver(os_type): name = "chromedriver" version = "2.26" url = "http://chromedriver.storage.googleapis.com" driver = ChromeDriver(driver_url=url, name=name, version=version, os_type=os_type) cache.download_driver(driver) assert cache.get_cached_binary(driver.name, driver.get_version(), os_type)
def test_should_be_false_for_new_driver(): name = "chromedriver" version = "2.26" url = "http://chromedriver.storage.googleapis.com" driver = ChromeDriver(driver_url=url, name=name, version=version, os_type="") cache_path = cache.get_cache_path() if os.path.exists(cache_path): shutil.rmtree(cache_path) assert cache.get_cached_binary( driver.name, driver.get_version(), os_type="win") is None
def test_cache_driver_version(): name = "chromedriver" version = "2.26" url = "http://chromedriver.storage.googleapis.com" os_type = "mac64" driver = ChromeDriver(driver_url=url, name=name, version=version, os_type=os_type) cache.download_driver(driver) binary = cache.get_cached_binary(driver.name, driver.get_version(), os_type) assert binary assert os.path.join(cache.get_cache_path(), name, version, name) == binary.path