end-to-end tests should log in via login-dev endpoint
This commit is contained in:
parent
586a1eee5d
commit
5df28ba331
@ -5,6 +5,7 @@ from urllib.parse import urljoin
|
||||
from .browsers import BROWSERSTACK_CONFIG
|
||||
from atst.domain.users import Users
|
||||
import atst.domain.exceptions as exceptions
|
||||
from atst.routes.dev import _DEV_USERS as DEV_USERS
|
||||
from tests.test_auth import _login
|
||||
|
||||
import cryptography.x509 as x509
|
||||
@ -15,7 +16,7 @@ USER_CERT = "ssl/client-certs/atat.mil.crt"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("browser_type", BROWSERSTACK_CONFIG.keys())
|
||||
@pytest.mark.usefixtures('live_server')
|
||||
@pytest.mark.usefixtures("live_server")
|
||||
def test_can_get_title(browser_type, app, drivers):
|
||||
driver = drivers[browser_type]
|
||||
driver.get(url_for("atst.root", _external=True))
|
||||
@ -42,28 +43,8 @@ def valid_user_from_cert():
|
||||
return Users.get_or_create_by_dod_id(**user_info)
|
||||
|
||||
|
||||
def _valid_login(client, driver):
|
||||
with open(USER_CERT) as cert:
|
||||
response = _login(client, cert=cert.read())
|
||||
cookie = [cookie for cookie in client.cookie_jar][0]
|
||||
driver.add_cookie(
|
||||
{
|
||||
"domain": None,
|
||||
"name": cookie.name,
|
||||
"value": cookie.value,
|
||||
"path": cookie.path,
|
||||
"secure": cookie.secure,
|
||||
"expiry": cookie.expires,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('live_server')
|
||||
@pytest.mark.usefixtures("live_server")
|
||||
def test_login(drivers, client, app, valid_user_from_cert):
|
||||
driver = drivers["win10_chrome62"]
|
||||
driver.get(url_for("atst.root", _external=True))
|
||||
cookie = _valid_login(client, driver)
|
||||
requests_page = url_for("requests.requests_form_new", screen=1, _external=True)
|
||||
driver.get(requests_page)
|
||||
user = valid_user_from_cert
|
||||
assert user.last_name in driver.page_source
|
||||
driver = drivers["win7_ie10"]
|
||||
driver.get(url_for("dev.login_dev", _external=True))
|
||||
assert "Sign in" not in driver.title
|
||||
|
Loading…
x
Reference in New Issue
Block a user