-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2646 from danswer-ai/slack-fix
Added quotes to project name to handle reserved words (#2639)
- Loading branch information
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
import time | ||
|
||
import pytest | ||
|
||
from danswer.configs.constants import DocumentSource | ||
from danswer.connectors.danswer_jira.connector import JiraConnector | ||
|
||
|
||
@pytest.fixture | ||
def jira_connector() -> JiraConnector: | ||
connector = JiraConnector( | ||
"https://danswerai.atlassian.net/jira/software/c/projects/AS/boards/6", | ||
comment_email_blacklist=[], | ||
) | ||
connector.load_credentials( | ||
{ | ||
"jira_user_email": os.environ["JIRA_USER_EMAIL"], | ||
"jira_api_token": os.environ["JIRA_API_TOKEN"], | ||
} | ||
) | ||
return connector | ||
|
||
|
||
def test_jira_connector_basic(jira_connector: JiraConnector) -> None: | ||
doc_batch_generator = jira_connector.poll_source(0, time.time()) | ||
|
||
doc_batch = next(doc_batch_generator) | ||
with pytest.raises(StopIteration): | ||
next(doc_batch_generator) | ||
|
||
assert len(doc_batch) == 1 | ||
|
||
doc = doc_batch[0] | ||
|
||
assert doc.id == "https://danswerai.atlassian.net/browse/AS-2" | ||
assert doc.semantic_identifier == "test123small" | ||
assert doc.source == DocumentSource.JIRA | ||
assert doc.metadata == {"priority": "Medium", "status": "Backlog"} | ||
assert doc.secondary_owners is None | ||
assert doc.title is None | ||
assert doc.from_ingestion_api is False | ||
assert doc.additional_info is None | ||
|
||
assert len(doc.sections) == 1 | ||
section = doc.sections[0] | ||
assert section.text == "example_text\n" | ||
assert section.link == "https://danswerai.atlassian.net/browse/AS-2" |