Skip to content

Commit

Permalink
update jira config used by unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
amp-rh committed Jan 22, 2024
1 parent 2f5239d commit 1824294
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tests/unittests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#
import json
import re
from dataclasses import dataclass

import pytest

Expand All @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit 1824294

Please sign in to comment.