Skip to content

implemented CommentProperty #1937

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

zerwes
Copy link

@zerwes zerwes commented Jan 25, 2025

handle comment properties analogue to the issue properties

example

is_internal_comment = False
try:
    p = jira.comment_property(425201, 'sd.public.comment')
    is_internal_comment = p.value.internal.lower() == 'true'
except JIRAError:
    pass

@adehad
Copy link
Contributor

adehad commented Apr 16, 2025

I think we can add a test similar to your example in the description in a file like
tests/resources/test_comment.py

Copy link
Contributor

@adehad adehad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent PR, let's get the pipeline passing and a test in

@zerwes
Copy link
Author

zerwes commented Apr 17, 2025

Hello @adehad

I think we can add a test similar to your example in the description in a file like tests/resources/test_comment.py

do you mean something like

diff --git a/tests/resources/test_comment.py b/tests/resources/test_comment.py
index 1dafc84..515c768 100644
--- a/tests/resources/test_comment.py
+++ b/tests/resources/test_comment.py
@@ -9,9 +9,10 @@ class CommentTests(JiraTestCase):
         self.issue_1_key = self.test_manager.project_b_issue1
         self.issue_2_key = self.test_manager.project_b_issue2
         self.issue_3_key = self.test_manager.project_b_issue3
+        self.issue_4_key = self.test_manager.project_b_issue4
 
     def tearDown(self) -> None:
-        for issue in [self.issue_1_key, self.issue_2_key, self.issue_3_key]:
+        for issue in [self.issue_1_key, self.issue_2_key, self.issue_3_key, self.issue_4_key]:
             for comment in self.jira.comments(issue):
                 comment.delete()
 
@@ -80,3 +81,10 @@ class CommentTests(JiraTestCase):
         comment.update(body="updated! without notification", notify=False)
         assert comment.body == "updated! without notification"
         comment.delete()
+
+    def test_comment_property(self):
+        comment = self.jira.add_comment(self.issue_4_key, "comment for property test")
+        comment_prop_data = {'internal': 'true'}
+        self.jira.add_comment_property(comment, 'sd.public.comment', comment_prop_data)
+        assert self.jira.comment_property(comment, 'sd.public.comment').value.internal.lower() == 'true'
+        comment.delete()

@adehad
Copy link
Contributor

adehad commented Apr 17, 2025

@zerwes Yes exactly something similar to this. I also suggest to add an additional assertion with an isinstance check

You don't need to create the issue 4 at the test setup level, reusing an existing issue should be fine.
Or also within the test function itself making a new comment is also perfect.

@zerwes
Copy link
Author

zerwes commented Apr 17, 2025

here we go: 37d7247
I preferred to use a own fct. w/ issue and comment to keep things clearly separated ... if you think this is to heavy, let me know, I can integrate it in another comment test.

Copy link
Contributor

@adehad adehad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent test, minor comment regarding the issue used.

We can ignore the docs build failures that's unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants