Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
328646b
fix: update secret variable names in jira_cloud_ci.yml
studioj Sep 13, 2025
b8fc080
test: add `@allow_on_cloud` decorator to `test_create_and_delete` in …
studioj Sep 13, 2025
0048f7f
fix: update trigger conditions and ref logic in jira_cloud_ci.yml
studioj Sep 13, 2025
150de46
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 13, 2025
3e64446
test: add `@allow_on_cloud` decorator to multiple comment tests in Co…
studioj Sep 13, 2025
3674637
test: add `@allow_on_cloud` decorator to multiple component tests in …
studioj Sep 13, 2025
6dfb4a9
test: add `@allow_on_cloud` decorator to `test_custom_field_option` i…
studioj Sep 13, 2025
afc2b90
test: add `@allow_on_cloud` decorator to multiple epic tests in EpicT…
studioj Sep 13, 2025
3a81587
test: add `@allow_on_cloud` decorator to multiple filter tests in Fil…
studioj Sep 13, 2025
f2fe5ff
test: add `@allow_on_cloud` decorator to `test_cls_for_resource` in G…
studioj Sep 13, 2025
268043f
test: add `@allow_on_cloud` decorator to IssueTests
studioj Sep 13, 2025
6f1740f
test: handle cloud-specific behavior in `test_issue_property`
studioj Sep 13, 2025
4997961
test: add delays in rank tests to avoid race conditions
studioj Sep 13, 2025
05f9cca
test: add `@allow_on_cloud` decorator to PrioritiesTests
studioj Sep 13, 2025
1396728
test: add `@allow_on_cloud` decorator to ProjectTests
studioj Sep 13, 2025
f443bf8
test: add `@allow_on_cloud` decorator to ProjectStatusesByIssueTypeTests
studioj Sep 13, 2025
2668029
test: add `@allow_on_cloud` decorator to RemoteLinkTests
studioj Sep 13, 2025
205fb86
test: add `@allow_on_cloud` decorator to ResolutionTests
studioj Sep 13, 2025
82f7e85
test: make delays in IssueTests cloud-aware to handle timing differences
studioj Sep 13, 2025
a84d89f
test: add delays and suppress exceptions in DashboardTests to improve…
studioj Sep 13, 2025
e0bc17c
test: adjust sleeptime in IssueTests for cloud environment stability
studioj Sep 13, 2025
a79be76
test: add `@allow_on_cloud` decorator to SprintTests
studioj Sep 13, 2025
0abf616
test: add `@allow_on_cloud` decorator to StatusTests
studioj Sep 13, 2025
3238169
test: add `@allow_on_cloud` decorator to StatusCategoryTests
studioj Sep 13, 2025
7ea8fb2
test: add `@allow_on_cloud` decorator to UserTests
studioj Sep 13, 2025
28169a8
test: add `@allow_on_cloud` decorator to VersionTests
studioj Sep 13, 2025
052f768
test: add `@allow_on_cloud` decorator to VoteTests
studioj Sep 13, 2025
2c7a2dc
test: update sprint field assertion in test_sprint.py
studioj Sep 13, 2025
a5a4e4c
test: rename test methods in test_exceptions.py for running as unittest
studioj Sep 13, 2025
209fb31
test: add `@allow_on_cloud` decorator to ClientTests
studioj Sep 13, 2025
0edcbe4
test: remove `@allow_on_cloud` decorator from ClientTests and adjust …
studioj Sep 13, 2025
8bca0fc
test: add `@allow_on_cloud` decorator to ResilientSessionTests and re…
studioj Sep 13, 2025
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
16 changes: 11 additions & 5 deletions .github/workflows/jira_cloud_ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: cloud

on:
pull_request:
push:
branches:
- main
- "*"
workflow_call:
inputs:
ref:
Expand Down Expand Up @@ -39,7 +44,8 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.inputs.ref }}
# Use correct ref for PRs and pushes
ref: ${{ github.head_ref || github.ref_name || github.event.inputs.ref }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
Expand All @@ -57,10 +63,10 @@ jobs:
run: tox run -e py310 -- -m allow_on_cloud
env:
CI_JIRA_TYPE: CLOUD
CI_JIRA_CLOUD_ADMIN: ${{ secrets.CLOUD_ADMIN }}
CI_JIRA_CLOUD_ADMIN_TOKEN: ${{ secrets.CLOUD_ADMIN_TOKEN }}
CI_JIRA_CLOUD_USER: ${{ secrets.CLOUD_USER }}
CI_JIRA_CLOUD_USER_TOKEN: ${{ secrets.CLOUD_USER_TOKEN }}
CI_JIRA_CLOUD_ADMIN: ${{ secrets.CI_JIRA_CLOUD_ADMIN }}
CI_JIRA_CLOUD_ADMIN_TOKEN: ${{ secrets.CI_JIRA_CLOUD_ADMIN_TOKEN }}
CI_JIRA_CLOUD_USER: ${{ secrets.CI_JIRA_CLOUD_USER }}
CI_JIRA_CLOUD_USER_TOKEN: ${{ secrets.CI_JIRA_CLOUD_USER_TOKEN }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
3 changes: 2 additions & 1 deletion tests/resources/test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from contextlib import contextmanager

from jira.resources import Board
from tests.conftest import JiraTestCase, rndstr
from tests.conftest import JiraTestCase, allow_on_cloud, rndstr


class BoardTests(JiraTestCase):
Expand Down Expand Up @@ -41,6 +41,7 @@ def _create_board(self) -> Iterator[Board]:
if board is not None:
board.delete()

@allow_on_cloud
def test_create_and_delete(self):
# GIVEN: The filter
# WHEN: we create a board
Expand Down
11 changes: 10 additions & 1 deletion tests/resources/test_comment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from tests.conftest import JiraTestCase
from tests.conftest import JiraTestCase, allow_on_cloud


class CommentTests(JiraTestCase):
Expand All @@ -15,6 +15,7 @@ def tearDown(self) -> None:
for comment in self.jira.comments(issue):
comment.delete()

@allow_on_cloud
def test_comments(self):
for issue in [self.issue_1_key, self.jira.issue(self.issue_2_key)]:
self.jira.issue(issue)
Expand All @@ -28,6 +29,7 @@ def test_comments(self):
comments = self.jira.comments(issue)
assert len(comments) == 0

@allow_on_cloud
def test_comments_start_at(self):
comments_created = []
for i in range(10):
Expand All @@ -42,6 +44,7 @@ def test_comments_start_at(self):
comments = self.jira.comments(self.issue_1_key)
assert len(comments) == 0

@allow_on_cloud
def test_comments_max_results(self):
comments_created = []
for i in range(10):
Expand All @@ -56,6 +59,7 @@ def test_comments_max_results(self):
comments = self.jira.comments(self.issue_1_key)
assert len(comments) == 0

@allow_on_cloud
def test_comments_order_by(self):
comments_created = []
for i in range(10):
Expand All @@ -73,6 +77,7 @@ def test_comments_order_by(self):
comments = self.jira.comments(self.issue_1_key)
assert len(comments) == 0

@allow_on_cloud
def test_expanded_comments(self):
comment1 = self.jira.add_comment(self.issue_1_key, "First comment")
comment2 = self.jira.add_comment(self.issue_1_key, "Second comment")
Expand All @@ -89,6 +94,7 @@ def test_expanded_comments(self):
comments = self.jira.comments(self.issue_1_key)
assert len(comments) == 0

@allow_on_cloud
def test_add_comment(self):
comment = self.jira.add_comment(
self.issue_3_key,
Expand All @@ -100,6 +106,7 @@ def test_add_comment(self):
self.assertEqual(comment.visibility.value, "Administrators")
comment.delete()

@allow_on_cloud
def test_add_comment_with_issue_obj(self):
issue = self.jira.issue(self.issue_3_key)
comment = self.jira.add_comment(
Expand All @@ -112,6 +119,7 @@ def test_add_comment_with_issue_obj(self):
self.assertEqual(comment.visibility.value, "Administrators")
comment.delete()

@allow_on_cloud
def test_update_comment(self):
comment = self.jira.add_comment(self.issue_3_key, "updating soon!")
comment.update(body="updated!")
Expand All @@ -120,6 +128,7 @@ def test_update_comment(self):
# self.assertEqual(comment.visibility.value, 'Administrators')
comment.delete()

@allow_on_cloud
def test_update_comment_with_notify(self):
comment = self.jira.add_comment(self.issue_3_key, "updating soon!")
comment.update(body="updated! without notification", notify=False)
Expand Down
5 changes: 4 additions & 1 deletion tests/resources/test_component.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from jira.exceptions import JIRAError
from tests.conftest import JiraTestCase, rndstr
from tests.conftest import JiraTestCase, allow_on_cloud, rndstr


class ComponentTests(JiraTestCase):
Expand All @@ -10,6 +10,7 @@ def setUp(self):
self.issue_1 = self.test_manager.project_b_issue1
self.issue_2 = self.test_manager.project_b_issue2

@allow_on_cloud
def test_2_create_component(self):
proj = self.jira.project(self.project_b)
name = f"project-{proj}-component-{rndstr()}"
Expand Down Expand Up @@ -67,6 +68,7 @@ def test_3_update(self):
self.assertEqual(component.lead.name, self.jira.current_user())
component.delete()

@allow_on_cloud
def test_4_delete(self):
component = self.jira.create_component(
"To be deleted", self.project_b, description="not long for this world"
Expand All @@ -75,6 +77,7 @@ def test_4_delete(self):
component.delete()
self.assertRaises(JIRAError, self.jira.component, myid)

@allow_on_cloud
def test_delete_component_by_id(self):
component = self.jira.create_component(
"To be deleted", self.project_b, description="not long for this world"
Expand Down
8 changes: 6 additions & 2 deletions tests/resources/test_custom_field_option.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from __future__ import annotations

from tests.conftest import JiraTestCase
from tests.conftest import JiraTestCase, allow_on_cloud


class CustomFieldOptionTests(JiraTestCase):
@allow_on_cloud
def test_custom_field_option(self):
expected = "Extensive / Widespread"
if not self.jira._is_cloud:
expected = "To Do"
option = self.jira.custom_field_option("10000")
self.assertEqual(option.value, "To Do")
self.assertEqual(option.value, expected)
8 changes: 6 additions & 2 deletions tests/resources/test_dashboard.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import time
from contextlib import suppress
from unittest import mock

import pytest
Expand Down Expand Up @@ -35,7 +37,8 @@ def setUp(self):

def tearDown(self):
for dashboard in self.dashboards_to_delete:
dashboard.delete()
with suppress(JIRAError):
dashboard.delete()
super().tearDown()

def test_dashboards(self):
Expand Down Expand Up @@ -261,6 +264,7 @@ def test_update_gadget(self):
name=rndstr(), share_permissions=[{"type": "authenticated"}]
)
self.dashboards_to_delete.append(dashboard)
time.sleep(1)
available_gadgets = self.jira.all_dashboard_gadgets()
filter_gadget = next(
gadget for gadget in available_gadgets if gadget.title == self.gadget_title
Expand All @@ -271,7 +275,7 @@ def test_update_gadget(self):
ignore_uri_and_module_key_validation=True,
uri=filter_gadget.uri,
)

time.sleep(1)
gadget = gadget.update(dashboard.id, color=new_color)
self.assertEqual(gadget.color, new_color)
self.assertEqual(gadget.raw["color"], new_color)
Expand Down
15 changes: 10 additions & 5 deletions tests/resources/test_epic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from parameterized import parameterized

from jira.resources import Issue
from tests.conftest import JiraTestCase, rndstr
from tests.conftest import JiraTestCase, allow_on_cloud, rndstr


class EpicTests(JiraTestCase):
Expand All @@ -33,24 +33,29 @@ def epic_field_name(self):
def make_epic(self, **kwargs) -> Iterator[Issue]:
try:
# TODO: create_epic() method should exist!
new_epic = self.jira.create_issue(
fields={
new_epic_fields = {
"issuetype": {"name": "Epic"},
"project": self.project_b,
self.epic_field_name: self.epic_name,
"summary": f"Epic summary for '{self.epic_name}'",
},
}
if not self.is_jira_cloud_ci:
new_epic_fields[self.epic_field_name] = self.epic_name
new_epic_fields.update(kwargs)
new_epic = self.jira.create_issue(
fields=new_epic_fields,
)
if len(kwargs):
raise ValueError("Incorrect kwarg used !")
yield new_epic
finally:
new_epic.delete()

@allow_on_cloud
def test_epic_create_delete(self):
with self.make_epic():
pass

@allow_on_cloud
@parameterized.expand(
[("str", str), ("list", list)],
)
Expand Down
12 changes: 10 additions & 2 deletions tests/resources/test_filter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import time
from contextlib import contextmanager

from tests.conftest import JiraTestCase, rndstr
from tests.conftest import JiraTestCase, allow_on_cloud, rndstr


class FilterTests(JiraTestCase):
Expand All @@ -27,21 +28,27 @@ def make_filter(self, **kwargs):
)
if len(kwargs):
raise ValueError("Incorrect kwarg used !")
if self.jira._is_cloud:
time.sleep(1)
yield new_filter
finally:
new_filter.delete()

@allow_on_cloud
def test_filter(self):
with self.make_filter() as myfilter:
self.assertEqual(myfilter.name, self.filter_name)
self.assertEqual(myfilter.owner.name, self.test_manager.user_admin.name)
if not self.is_jira_cloud_ci:
self.assertEqual(myfilter.owner.name, self.test_manager.user_admin.name)

@allow_on_cloud
def test_favourite_filters(self):
filter_name = f"filter-to-fav-{self.filter_name}"
with self.make_filter(name=filter_name, favourite=True):
new_filters = self.jira.favourite_filters()
assert filter_name in [f.name for f in new_filters]

@allow_on_cloud
def test_filter_update_empty_description(self):
new_jql = f"{self.filter_jql} ORDER BY created ASC"
new_name = f"new_{self.filter_name}"
Expand All @@ -58,6 +65,7 @@ def test_filter_update_empty_description(self):
assert updated_filter.jql == new_jql
assert not hasattr(updated_filter, "description")

@allow_on_cloud
def test_filter_update_empty_description_with_new_description(self):
new_desc = "new description"
with self.make_filter(description=None) as myfilter:
Expand Down
2 changes: 2 additions & 0 deletions tests/resources/test_generic_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest

import jira.resources
from tests.conftest import allow_on_cloud

MOCK_URL = "http://customized-jira.com/rest/"

Expand Down Expand Up @@ -43,6 +44,7 @@ class TestResource:
],
)
# fmt: on
@allow_on_cloud
def test_cls_for_resource(self, example_url, expected_class):
"""Test the regex recognizes the right class for a given URL."""
assert jira.resources.cls_for_resource(example_url) == expected_class
Loading
Loading