def test_auth_type_none(monkeypatch): from pytest_selenium.drivers.saucelabs import SauceLabs, get_job_url monkeypatch.setenv("SAUCELABS_USERNAME", "foo") monkeypatch.setenv("SAUCELABS_API_KEY", "bar") session_id = "123456" expected = "https://saucelabs.com/jobs/{}".format(session_id) actual = get_job_url(Config("none"), SauceLabs(), session_id) assert actual == expected
def test_auth_type_none(monkeypatch): from pytest_selenium.drivers.saucelabs import SauceLabs, get_job_url monkeypatch.setenv('SAUCELABS_USERNAME', 'foo') monkeypatch.setenv('SAUCELABS_API_KEY', 'bar') session_id = '123456' expected = 'https://saucelabs.com/jobs/{}'.format(session_id) actual = get_job_url(Config('none'), SauceLabs(), session_id) assert actual == expected
def test_auth_type_expiration(monkeypatch, auth_type): import re from pytest_selenium.drivers.saucelabs import SauceLabs, get_job_url monkeypatch.setenv("SAUCELABS_USERNAME", "foo") monkeypatch.setenv("SAUCELABS_API_KEY", "bar") session_id = "123456" expected_pattern = (r"https://saucelabs\.com/jobs/" r"{}\?auth=[a-f0-9]{{32}}$".format(session_id)) actual = get_job_url(Config(auth_type), SauceLabs(), session_id) assert re.match(expected_pattern, actual)
def test_auth_type_expiration(monkeypatch, auth_type): import re from pytest_selenium.drivers.saucelabs import SauceLabs, get_job_url monkeypatch.setenv('SAUCELABS_USERNAME', 'foo') monkeypatch.setenv('SAUCELABS_API_KEY', 'bar') session_id = '123456' expected_pattern = r'https://saucelabs\.com/jobs/' \ r'{}\?auth=[a-f0-9]{{32}}$'.format(session_id) actual = get_job_url(Config(auth_type), SauceLabs(), session_id) assert re.match(expected_pattern, actual)
def test_auth_type_expiration(monkeypatch, auth_type): import re from pytest_selenium.drivers.saucelabs import SauceLabs, get_job_url monkeypatch.setenv("SAUCELABS_USERNAME", "foo") monkeypatch.setenv("SAUCELABS_API_KEY", "bar") session_id = "123456" expected_pattern = ( r"https://saucelabs\.com/jobs/" r"{}\?auth=[a-f0-9]{{32}}$".format(session_id) ) actual = get_job_url(Config(auth_type), SauceLabs(), session_id) assert re.match(expected_pattern, actual)
def test_auth_token(monkeypatch, auth_type, auth_token): import datetime from pytest_selenium.drivers.saucelabs import SauceLabs, get_job_url monkeypatch.setattr(datetime, 'datetime', MonkeyDatetime) monkeypatch.setenv('SAUCELABS_USERNAME', 'foo') monkeypatch.setenv('SAUCELABS_API_KEY', 'bar') session_id = '12345678' url = 'https://saucelabs.com/jobs/{}'.format(session_id) if auth_type != 'none': url += '?auth={}'.format(auth_token) result = get_job_url(Config(auth_type), SauceLabs(), session_id) assert result == url