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 .browsers import BROWSERSTACK_CONFIG
|
||||||
from atst.domain.users import Users
|
from atst.domain.users import Users
|
||||||
import atst.domain.exceptions as exceptions
|
import atst.domain.exceptions as exceptions
|
||||||
|
from atst.routes.dev import _DEV_USERS as DEV_USERS
|
||||||
from tests.test_auth import _login
|
from tests.test_auth import _login
|
||||||
|
|
||||||
import cryptography.x509 as x509
|
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.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):
|
def test_can_get_title(browser_type, app, drivers):
|
||||||
driver = drivers[browser_type]
|
driver = drivers[browser_type]
|
||||||
driver.get(url_for("atst.root", _external=True))
|
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)
|
return Users.get_or_create_by_dod_id(**user_info)
|
||||||
|
|
||||||
|
|
||||||
def _valid_login(client, driver):
|
@pytest.mark.usefixtures("live_server")
|
||||||
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')
|
|
||||||
def test_login(drivers, client, app, valid_user_from_cert):
|
def test_login(drivers, client, app, valid_user_from_cert):
|
||||||
driver = drivers["win10_chrome62"]
|
driver = drivers["win7_ie10"]
|
||||||
driver.get(url_for("atst.root", _external=True))
|
driver.get(url_for("dev.login_dev", _external=True))
|
||||||
cookie = _valid_login(client, driver)
|
assert "Sign in" not in driver.title
|
||||||
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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user