Change in method name for creating an issue on JIRA (#3307)

The awesome JIRA tool created by @zywilliamli calls the `create_issue()`
method to create issues, however, the actual method is `issue_create()`.

Details in the Documentation here:
https://atlassian-python-api.readthedocs.io/jira.html#manage-issues
This commit is contained in:
Varun Srinivas 2023-04-22 01:31:33 +05:30 committed by GitHub
parent e933be9605
commit d2f922f525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 2 deletions

View File

@ -159,7 +159,7 @@ class JiraAPIWrapper(BaseModel):
"json is not installed. " "Please install it with `pip install json`"
)
params = json.loads(query)
return self.jira.create_issue(fields=dict(params))
return self.jira.issue_create(fields=dict(params))
def other(self, query: str) -> str:
context = {"self": self}

View File

@ -7,3 +7,11 @@ OPENAI_API_KEY=
PINECONE_API_KEY=your_pinecone_api_key_here
# your pinecone environment from left menu "API Keys" in https://app.pinecone.io
PINECONE_ENVIRONMENT=us-west4-gcp
# jira
# your api token from https://id.atlassian.com/manage-profile/security/api-tokens
# more details here: https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html
# JIRA_API_TOKEN=your_jira_api_token_here
# JIRA_USERNAME=your_jira_username_here
# JIRA_INSTANCE_URL=your_jira_instance_url_here

View File

@ -0,0 +1,24 @@
"""Integration test for JIRA API Wrapper."""
from langchain.utilities.jira import JiraAPIWrapper
import json
def test_search() -> None:
"""Test for Searching issues on JIRA"""
jql = "project = TP"
jira = JiraAPIWrapper()
output = jira.run("jql", jql)
assert 'issues' in output
def test_getprojects() -> None:
"""Test for getting projects on JIRA"""
jira = JiraAPIWrapper()
output = jira.run("get_projects", "")
assert 'projects' in output
def test_create_ticket() -> None:
"""Test the Create Ticket Call that Creates a Issue/Ticket on JIRA."""
issue_string = '{"summary": "Test Summary", "description": "Test Description", "issuetype": {"name": "Bug"}, "project": {"key": "TP"}}'
jira = JiraAPIWrapper()
output = jira.run("create_issue", issue_string)
assert 'id' in output
assert 'key' in output