From 83830e91297046e799458c7a677dfea02d460adc Mon Sep 17 00:00:00 2001 From: Michael Pruitt Date: Fri, 19 Jan 2024 12:17:04 -0600 Subject: [PATCH] update jira config used by unit tests. --- tests/unittests/conftest.py | 4 +++- ...es_should_not_cause_failure_for_ignored_step.py | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/unittests/conftest.py b/tests/unittests/conftest.py index 14da98cb..d9784832 100644 --- a/tests/unittests/conftest.py +++ b/tests/unittests/conftest.py @@ -32,6 +32,8 @@ FIREWATCH_DEFAULT_JIRA_PROJECT_ENV_VAR = "FIREWATCH_DEFAULT_JIRA_PROJECT" FIREWATCH_DEFAULT_JIRA_EPIC_ENV_VAR = "FIREWATCH_DEFAULT_JIRA_EPIC" ARTIFACT_DIR_ENV_VAR = "ARTIFACT_DIR" +JIRA_SERVER_URL_ENV_VAR = "JIRA_SERVER_URL" +DEFAULT_JIRA_SERVER_URL = "https://issues.stage.redhat.com" JIRA_TOKEN_ENV_VAR = "JIRA_TOKEN" FIREWATCH_CONFIG_ENV_VAR = "FIREWATCH_CONFIG" @@ -249,7 +251,7 @@ def jira_config_path(tmp_path): json.dumps( { "token": os.getenv(JIRA_TOKEN_ENV_VAR), - "url": "https://issues.stage.redhat.com", + "url": os.getenv(JIRA_SERVER_URL_ENV_VAR, DEFAULT_JIRA_SERVER_URL), "proxies": { "http": "http://squid.corp.redhat.com:3128", "https": "http://squid.corp.redhat.com:3128", diff --git a/tests/unittests/objects/job/test_fail_with_test_failures_should_not_cause_failure_for_ignored_step.py b/tests/unittests/objects/job/test_fail_with_test_failures_should_not_cause_failure_for_ignored_step.py index 246945cb..86e9be7c 100644 --- a/tests/unittests/objects/job/test_fail_with_test_failures_should_not_cause_failure_for_ignored_step.py +++ b/tests/unittests/objects/job/test_fail_with_test_failures_should_not_cause_failure_for_ignored_step.py @@ -15,6 +15,7 @@ # import json import re +from dataclasses import dataclass import pytest @@ -23,8 +24,17 @@ from tests.unittests.conftest import FIREWATCH_CONFIG_ENV_VAR +@pytest.fixture() +def mock_jira(): + @dataclass + class MockJira: + ... + + yield MockJira + + @pytest.fixture -def firewatch_config(monkeypatch, jira, default_jira_project): +def firewatch_config(monkeypatch, mock_jira, default_jira_project): monkeypatch.setenv( FIREWATCH_CONFIG_ENV_VAR, json.dumps( @@ -42,7 +52,7 @@ def firewatch_config(monkeypatch, jira, default_jira_project): ), ) yield Configuration( - jira=jira, + jira=mock_jira, fail_with_test_failures=True, keep_job_dir=True, verbose_test_failure_reporting=False,