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