Update org tests to use new method, update Github configuration in tests

This commit is contained in:
sabaimran 2023-06-27 15:04:48 -07:00
parent 227169ebde
commit 2697c7a186
2 changed files with 20 additions and 15 deletions

View file

@ -17,6 +17,7 @@ from khoj.utils.rawconfig import (
ProcessorConfig,
TextContentConfig,
GithubContentConfig,
GithubRepoConfig,
ImageContentConfig,
SearchConfig,
TextSearchConfig,
@ -92,9 +93,13 @@ def content_config(tmp_path_factory, search_config: SearchConfig):
content_config.github = GithubContentConfig(
pat_token=os.getenv("GITHUB_PAT_TOKEN", ""),
repo_name="lantern",
repo_owner="khoj-ai",
repo_branch="master",
repos=[
GithubRepoConfig(
owner="khoj-ai",
name="lantern",
branch="master",
)
],
compressed_jsonl=content_dir.joinpath("github.jsonl.gz"),
embeddings_file=content_dir.joinpath("github_embeddings.pt"),
)

View file

@ -14,7 +14,7 @@ def test_parse_entry_with_no_headings(tmp_path):
orgfile = create_file(tmp_path, entry)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 1
@ -38,7 +38,7 @@ Body Line 1"""
orgfile = create_file(tmp_path, entry)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 1
@ -71,7 +71,7 @@ Body Line 2"""
orgfile = create_file(tmp_path, entry)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 1
@ -109,7 +109,7 @@ def test_render_entry_with_property_drawer_and_empty_body(tmp_path):
"""
# Act
parsed_entries = orgnode.makelist(orgfile)
parsed_entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert f"{parsed_entries[0]}" == expected_entry
@ -131,7 +131,7 @@ Body Line 2
orgfile = create_file(tmp_path, entry)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
# SOURCE link rendered with Heading
@ -155,7 +155,7 @@ Body Line 1"""
orgfile = create_file(tmp_path, entry, filename="test[1].org")
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 1
@ -197,7 +197,7 @@ Body 2
orgfile = create_file(tmp_path, content)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 2
@ -225,7 +225,7 @@ Body Line 1"""
orgfile = create_file(tmp_path, entry)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 1
@ -248,7 +248,7 @@ Body Line 1"""
orgfile = create_file(tmp_path, entry)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 1
@ -272,7 +272,7 @@ Body Line 1
orgfile = create_file(tmp_path, entry)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 1
@ -298,7 +298,7 @@ entry body
orgfile = create_file(tmp_path, body)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 2
@ -320,7 +320,7 @@ entry body
orgfile = create_file(tmp_path, body)
# Act
entries = orgnode.makelist(orgfile)
entries = orgnode.makelist_with_filepath(orgfile)
# Assert
assert len(entries) == 2