Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX CRINGE #40

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions overhave/admin/views/emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ def edit_view(self) -> werkzeug.Response | None:
return rendered

test_user_id = data["test_user"]
if not self._ensure_no_active_emulation_runs_for_user(int(test_user_id)):
if self._ensure_has_active_emulation_runs_for_user(int(test_user_id)):
flask.flash(f"Unable to run new emulation in parallel for user {test_user_id}")
return rendered

logger.debug("Seen emulation request")
return self._run_emulation(emulation_id)

@staticmethod
def _ensure_no_active_emulation_runs_for_user(test_user_id: int) -> bool:
def _ensure_has_active_emulation_runs_for_user(test_user_id: int) -> bool:
factory = get_admin_factory()
return factory.emulation_storage.has_running_emulation_with_user(test_user_id)
12 changes: 4 additions & 8 deletions overhave/admin/views/scenario_test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,11 @@ def on_model_delete(self, model: db.TestRun) -> None:

@staticmethod
def _run_test(rendered: werkzeug.Response) -> werkzeug.Response:
current_test_run_id = get_mdict_item_or_list(flask.request.args, "id")
current_scenario_id = int(get_mdict_item_or_list(flask.request.args, "id"))
artamaney marked this conversation as resolved.
Show resolved Hide resolved
factory = get_admin_factory()

with db.create_session() as session:
scenario_id = (
session.query(db.TestRun.scenario_id).filter(db.TestRun.id == current_test_run_id).one().scenario_id
)

test_run_id = factory.test_run_storage.create_testrun(scenario_id=scenario_id, executed_by=current_user.login)
test_run_id = factory.test_run_storage.create_testrun(
scenario_id=current_scenario_id, executed_by=current_user.login
)

if not factory.context.admin_settings.consumer_based:
proxy_manager = get_proxy_manager()
Expand Down
2 changes: 1 addition & 1 deletion overhave/transport/ldap/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _connect(self, login: str, password: SecretStr) -> None:
ldap_connection.set_option(ldap.OPT_REFERRALS, 0)
ldap_connection.set_option(ldap.OPT_NETWORK_TIMEOUT, self._settings.timeout.seconds)
if self._settings.tls_enabled:
ldap_connection.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_REQUIRE_CERT)
ldap_connection.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_HARD)
ldap_connection.start_tls_s()
ldap_connection.simple_bind_s(f"{self._settings.domain}{login}", password.get_secret_value())
self._ldap_connection = ldap_connection
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "overhave"
version = "5.1.1"
version = "5.1.2"
description = "Overhave - web-framework for BDD"
readme = "README.rst"
authors = [
Expand Down
Loading