e2e: test against standalone chrome instance, start implementing oidc provider test
This commit is contained in:
parent
c83216ece0
commit
8c6a4a4968
|
@ -1,34 +1,11 @@
|
||||||
version: '3.7'
|
version: '3.7'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# hub:
|
|
||||||
# image: dosel/zalenium
|
|
||||||
# command: start
|
|
||||||
# ports:
|
|
||||||
# - 4444:4444
|
|
||||||
# environment:
|
|
||||||
# PULL_SELENIUM_IMAGE: 'true'
|
|
||||||
# volumes:
|
|
||||||
# - /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
# - /tmp/videos:/home/seluser/videos
|
|
||||||
# privileged: true
|
|
||||||
chrome:
|
chrome:
|
||||||
image: selenium/node-chrome:3.14.0-gallium
|
image: selenium/standalone-chrome-debug:3.141.59-20200525
|
||||||
volumes:
|
volumes:
|
||||||
- /dev/shm:/dev/shm
|
- /dev/shm:/dev/shm
|
||||||
depends_on:
|
network_mode: host
|
||||||
- hub
|
|
||||||
environment:
|
|
||||||
HUB_HOST: hub
|
|
||||||
networks:
|
|
||||||
- e2e
|
|
||||||
|
|
||||||
hub:
|
|
||||||
image: selenium/hub:3.14.0-gallium
|
|
||||||
ports:
|
|
||||||
- "4444:4444"
|
|
||||||
networks:
|
|
||||||
- e2e
|
|
||||||
|
|
||||||
postgresql:
|
postgresql:
|
||||||
image: postgres:11
|
image: postgres:11
|
||||||
|
@ -36,24 +13,8 @@ services:
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_HOST_AUTH_METHOD: trust
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
POSTGRES_DB: passbook
|
POSTGRES_DB: passbook
|
||||||
networks:
|
network_mode: host
|
||||||
- e2e
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
network_mode: host
|
||||||
- e2e
|
|
||||||
passbook:
|
|
||||||
image: beryju/passbook
|
|
||||||
command: /bin/bash -c "sleep infinity"
|
|
||||||
volumes:
|
|
||||||
- ../:/testing
|
|
||||||
environment:
|
|
||||||
PASSBOOK_ENV: docker
|
|
||||||
user: root
|
|
||||||
working_dir: /testing
|
|
||||||
networks:
|
|
||||||
- e2e
|
|
||||||
|
|
||||||
networks:
|
|
||||||
e2e:
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
selenium
|
||||||
|
docker
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash -x
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y python3.8 python3-pip apt-transport-https ca-certificates curl gnupg-agent software-properties-common
|
||||||
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||||
|
sudo add-apt-repository \
|
||||||
|
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||||
|
$(lsb_release -cs) \
|
||||||
|
stable"
|
||||||
|
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
||||||
|
sudo usermod -a -G docker ubuntu
|
||||||
|
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||||
|
sudo chmod +x /usr/local/bin/docker-compose
|
||||||
|
sudo pip3 install pipenv
|
||||||
|
|
||||||
|
cd e2e
|
||||||
|
sudo docker-compose up -d
|
||||||
|
cd ..
|
||||||
|
pipenv sync --dev
|
||||||
|
pipenv run pip install -r e2e/requirements.txt
|
||||||
|
pipenv shell
|
|
@ -17,11 +17,9 @@ from e2e.utils import apply_default_data
|
||||||
class TestEnroll2Step(StaticLiveServerTestCase):
|
class TestEnroll2Step(StaticLiveServerTestCase):
|
||||||
"""Test 2-step enroll flow"""
|
"""Test 2-step enroll flow"""
|
||||||
|
|
||||||
host = "passbook"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.driver = webdriver.Remote(
|
self.driver = webdriver.Remote(
|
||||||
command_executor="http://hub:4444/wd/hub",
|
command_executor="http://localhost:4444/wd/hub",
|
||||||
desired_capabilities=DesiredCapabilities.CHROME,
|
desired_capabilities=DesiredCapabilities.CHROME,
|
||||||
)
|
)
|
||||||
self.driver.implicitly_wait(5)
|
self.driver.implicitly_wait(5)
|
||||||
|
|
|
@ -10,11 +10,9 @@ from e2e.utils import apply_default_data
|
||||||
class TestLogin(StaticLiveServerTestCase):
|
class TestLogin(StaticLiveServerTestCase):
|
||||||
"""test default login flow"""
|
"""test default login flow"""
|
||||||
|
|
||||||
host = "passbook"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.driver = webdriver.Remote(
|
self.driver = webdriver.Remote(
|
||||||
command_executor="http://hub:4444/wd/hub",
|
command_executor="http://localhost:4444/wd/hub",
|
||||||
desired_capabilities=DesiredCapabilities.CHROME,
|
desired_capabilities=DesiredCapabilities.CHROME,
|
||||||
)
|
)
|
||||||
self.driver.implicitly_wait(5)
|
self.driver.implicitly_wait(5)
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PolicyEvaluator(BaseEvaluator):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._messages = []
|
self._messages = []
|
||||||
self._context["pb_message"] = self.expr_func_message
|
self._context["pb_message"] = self.expr_func_message
|
||||||
self._filename = policy_name
|
self._filename = policy_name or "PolicyEvaluator"
|
||||||
|
|
||||||
def expr_func_message(self, message: str):
|
def expr_func_message(self, message: str):
|
||||||
"""Wrapper to append to messages list, which is returned with PolicyResult"""
|
"""Wrapper to append to messages list, which is returned with PolicyResult"""
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"""passbook OIDC Views"""
|
"""passbook OIDC Views"""
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.http import HttpRequest, HttpResponse, JsonResponse
|
from django.http import HttpRequest, HttpResponse, JsonResponse
|
||||||
from django.shortcuts import get_object_or_404, redirect, reverse
|
from django.shortcuts import get_object_or_404, redirect, reverse
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
@ -28,7 +29,7 @@ LOGGER = get_logger()
|
||||||
PLAN_CONTEXT_PARAMS = "params"
|
PLAN_CONTEXT_PARAMS = "params"
|
||||||
|
|
||||||
|
|
||||||
class AuthorizationFlowInitView(AccessMixin, View):
|
class AuthorizationFlowInitView(AccessMixin, LoginRequiredMixin, View):
|
||||||
"""OIDC Flow initializer, checks access to application and starts flow"""
|
"""OIDC Flow initializer, checks access to application and starts flow"""
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
{% block beneath_form %}
|
{% block beneath_form %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<div class="pf-c-form__group pf-m-action">
|
<div class="pf-c-form__group pf-m-action">
|
||||||
<button class="pf-c-button pf-m-primary pf-m-block" type="submit">{% trans "Send Recovery Email." %}</button>
|
<button class="pf-c-button pf-m-primary pf-m-block" type="submit">{% trans "Send Email." %}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Reference in New Issue