Add separate unit test for github. Will only run of a PAT token is set

This commit is contained in:
Saba
2023-06-13 16:55:58 -07:00
parent 3a61919344
commit 751edfefe5
3 changed files with 29 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
# System Packages
import logging
from pathlib import Path
import os
# External Packages
import pytest
@@ -10,6 +11,7 @@ from khoj.utils.state import model
from khoj.search_type import text_search
from khoj.utils.rawconfig import ContentConfig, SearchConfig, TextContentConfig
from khoj.processor.org_mode.org_to_jsonl import OrgToJsonl
from khoj.processor.github.github_to_jsonl import GithubToJsonl
# Test
@@ -170,3 +172,14 @@ def test_incremental_update(content_config: ContentConfig, search_config: Search
# Cleanup
# reset input_files in config to empty list
content_config.org.input_files = []
# ----------------------------------------------------------------------------------------------------
@pytest.mark.skipif(os.getenv("GITHUB_PAT_TOKEN") is None, reason="GITHUB_PAT_TOKEN not set")
def test_asymmetric_setup_github(content_config: ContentConfig, search_config: SearchConfig):
# Act
# Regenerate notes embeddings during asymmetric setup
github_model = text_search.setup(GithubToJsonl, content_config.github, search_config.asymmetric, regenerate=True)
# Assert
assert len(github_model.entries) > 1