mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Update org tests to use new method, update Github configuration in tests
This commit is contained in:
@@ -17,6 +17,7 @@ from khoj.utils.rawconfig import (
|
|||||||
ProcessorConfig,
|
ProcessorConfig,
|
||||||
TextContentConfig,
|
TextContentConfig,
|
||||||
GithubContentConfig,
|
GithubContentConfig,
|
||||||
|
GithubRepoConfig,
|
||||||
ImageContentConfig,
|
ImageContentConfig,
|
||||||
SearchConfig,
|
SearchConfig,
|
||||||
TextSearchConfig,
|
TextSearchConfig,
|
||||||
@@ -92,9 +93,13 @@ def content_config(tmp_path_factory, search_config: SearchConfig):
|
|||||||
|
|
||||||
content_config.github = GithubContentConfig(
|
content_config.github = GithubContentConfig(
|
||||||
pat_token=os.getenv("GITHUB_PAT_TOKEN", ""),
|
pat_token=os.getenv("GITHUB_PAT_TOKEN", ""),
|
||||||
repo_name="lantern",
|
repos=[
|
||||||
repo_owner="khoj-ai",
|
GithubRepoConfig(
|
||||||
repo_branch="master",
|
owner="khoj-ai",
|
||||||
|
name="lantern",
|
||||||
|
branch="master",
|
||||||
|
)
|
||||||
|
],
|
||||||
compressed_jsonl=content_dir.joinpath("github.jsonl.gz"),
|
compressed_jsonl=content_dir.joinpath("github.jsonl.gz"),
|
||||||
embeddings_file=content_dir.joinpath("github_embeddings.pt"),
|
embeddings_file=content_dir.joinpath("github_embeddings.pt"),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ def test_parse_entry_with_no_headings(tmp_path):
|
|||||||
orgfile = create_file(tmp_path, entry)
|
orgfile = create_file(tmp_path, entry)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
@@ -38,7 +38,7 @@ Body Line 1"""
|
|||||||
orgfile = create_file(tmp_path, entry)
|
orgfile = create_file(tmp_path, entry)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
@@ -71,7 +71,7 @@ Body Line 2"""
|
|||||||
orgfile = create_file(tmp_path, entry)
|
orgfile = create_file(tmp_path, entry)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
@@ -109,7 +109,7 @@ def test_render_entry_with_property_drawer_and_empty_body(tmp_path):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
parsed_entries = orgnode.makelist(orgfile)
|
parsed_entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert f"{parsed_entries[0]}" == expected_entry
|
assert f"{parsed_entries[0]}" == expected_entry
|
||||||
@@ -131,7 +131,7 @@ Body Line 2
|
|||||||
orgfile = create_file(tmp_path, entry)
|
orgfile = create_file(tmp_path, entry)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
# SOURCE link rendered with Heading
|
# SOURCE link rendered with Heading
|
||||||
@@ -155,7 +155,7 @@ Body Line 1"""
|
|||||||
orgfile = create_file(tmp_path, entry, filename="test[1].org")
|
orgfile = create_file(tmp_path, entry, filename="test[1].org")
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
@@ -197,7 +197,7 @@ Body 2
|
|||||||
orgfile = create_file(tmp_path, content)
|
orgfile = create_file(tmp_path, content)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 2
|
assert len(entries) == 2
|
||||||
@@ -225,7 +225,7 @@ Body Line 1"""
|
|||||||
orgfile = create_file(tmp_path, entry)
|
orgfile = create_file(tmp_path, entry)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
@@ -248,7 +248,7 @@ Body Line 1"""
|
|||||||
orgfile = create_file(tmp_path, entry)
|
orgfile = create_file(tmp_path, entry)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
@@ -272,7 +272,7 @@ Body Line 1
|
|||||||
orgfile = create_file(tmp_path, entry)
|
orgfile = create_file(tmp_path, entry)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
@@ -298,7 +298,7 @@ entry body
|
|||||||
orgfile = create_file(tmp_path, body)
|
orgfile = create_file(tmp_path, body)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 2
|
assert len(entries) == 2
|
||||||
@@ -320,7 +320,7 @@ entry body
|
|||||||
orgfile = create_file(tmp_path, body)
|
orgfile = create_file(tmp_path, body)
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
entries = orgnode.makelist(orgfile)
|
entries = orgnode.makelist_with_filepath(orgfile)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(entries) == 2
|
assert len(entries) == 2
|
||||||
|
|||||||
Reference in New Issue
Block a user