From 2697c7a186d7a19909cea623ea01eb35549ca4e7 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Tue, 27 Jun 2023 15:04:48 -0700 Subject: [PATCH] Update org tests to use new method, update Github configuration in tests --- tests/conftest.py | 11 ++++++++--- tests/test_orgnode.py | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index d4638adb..c5a000e3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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"), ) diff --git a/tests/test_orgnode.py b/tests/test_orgnode.py index 9232210c..ed26966b 100644 --- a/tests/test_orgnode.py +++ b/tests/test_orgnode.py @@ -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