def test_example(): chrome = Chromeless() chrome.attach(example) chrome.attach(second_method) result = chrome.example(demo_url) print(result) return result
def test_api(): chrome = Chromeless(os.getenv('API_URL', "None"), os.getenv('API_KEY', "None")) chrome.attach(example) chrome.attach(second_method) result = chrome.example(demo_url) print(result) return result
def test_example_with_session_arg(): session = Session() # valid default session chrome = Chromeless(boto3_session=session) chrome.attach(example) chrome.attach(second_method) title, png, divcnt = chrome.example(demo_url) assert_response(title, png, divcnt) # should work session = Session(aws_access_key_id='FOO', aws_secret_access_key='BAR', region_name='ap-northeast-1') # invalid session chrome = Chromeless(boto3_session=session) chrome.attach(example) chrome.attach(second_method) try: chrome.example(demo_url) # shouldn't work except Exception as e: assert str(e).startswith("Invalid session or AWS credentials") else: raise Exception("No expected exception")
def test_example_locally_named_arg(): chrome = Chromeless(function_name="local") chrome.attach(example) chrome.attach(second_method) title, png, divcnt = chrome.example(url=demo_url) assert_response(title, png, divcnt)
def test_api(): chrome = Chromeless(os.environ['API_URL'], os.environ['API_KEY']) chrome.attach(example) chrome.attach(second_method) title, png, divcnt = chrome.example(demo_url) assert_response(title, png, divcnt)
def test_example(): chrome = Chromeless() chrome.attach(example) chrome.attach(second_method) title, png, divcnt = chrome.example(demo_url) assert_response(title, png, divcnt)