Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_visit(self):
"Browser.visit should call driver.visit"
with Mock() as mock:
mock.visit('http://foo.com')
with Stub() as browser:
from splinter.driver import WebDriver
WebDriver() >> mock
browser = Browser()
browser.visit('http://foo.com')
WebDriver.restore_import()
mock.validate()
def test_quit(self):
"Browser.quit should call driver.quit"
with Mock() as mock:
mock.quit()
with Stub() as browser:
from splinter.driver import WebDriver
WebDriver() >> mock
browser = Browser()
browser.quit()
WebDriver.restore_import()
mock.validate()
def test_visit(self):
"WebDriver.visit should call browser.get"
with Mock() as firefox_mock:
firefox_mock.get('http://foo.com')
with ReplaceBrowser(firefox_mock):
driver = WebDriver()
driver.visit('http://foo.com')
firefox_mock.validate()
def test_quit(self):
"Browser.quit should call driver.quit"
with Mock() as mock:
mock.quit()
with Stub() as browser:
from splinter.driver import WebDriver
WebDriver() >> mock
browser = Browser()
browser.quit()
WebDriver.restore_import()
mock.validate()
def test_quit(self):
"WebDriver.quit should call browser.quit"
with Mock() as firefox_mock:
firefox_mock.quit()
with ReplaceBrowser(firefox_mock):
driver = WebDriver()
driver.quit()
firefox_mock.validate()
def test_title(self):
"WebDriver.title should call browser.title"
with Mock() as firefox_mock:
firefox_mock.get_title()
with ReplaceBrowser(firefox_mock):
driver = WebDriver()
driver.title
firefox_mock.validate()