Skip to content

Commit

Permalink
[tests]: Updated the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
keenborder786 committed Jan 10, 2025
1 parent 095c235 commit af6c394
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions libs/community/tests/unit_tests/document_loaders/test_lakefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,28 @@ class TestLakeFSLoader(unittest.TestCase):
ref: str = "ref"
path: str = "path"

def setUp(self):
# Initialize the LakeFSLoader with real objects
self.loader = LakeFSLoader(
lakefs_access_key=self.lakefs_access_key,
lakefs_secret_key=self.lakefs_secret_key,
lakefs_endpoint=self.endpoint,
)
self.loader.set_repo(self.repo)
self.loader.set_ref(self.ref)
self.loader.set_path(self.path)

@requests_mock.Mocker()
@pytest.mark.usefixtures("mock_lakefs_client_no_presign_not_local")
def test_non_presigned_loading_fail(self, mocker: Mocker) -> None:
mocker.register_uri(requests_mock.ANY, requests_mock.ANY, status_code=200)
loader = LakeFSLoader(
self.lakefs_access_key, self.lakefs_secret_key, self.endpoint
)
loader.set_repo(self.repo)
loader.set_ref(self.ref)
loader.set_path(self.path)
with pytest.raises(ImportError):
loader.load()
with pytest.raises(ValueError, match="Non pre-signed URLs are supported only with 'local' blockstore"):

Check failure on line 82 in libs/community/tests/unit_tests/document_loaders/test_lakefs.py

View workflow job for this annotation

GitHub Actions / cd libs/community / make lint #3.13

Ruff (E501)

tests/unit_tests/document_loaders/test_lakefs.py:82:89: E501 Line too long (111 > 88)

Check failure on line 82 in libs/community/tests/unit_tests/document_loaders/test_lakefs.py

View workflow job for this annotation

GitHub Actions / cd libs/community / make lint #3.9

Ruff (E501)

tests/unit_tests/document_loaders/test_lakefs.py:82:89: E501 Line too long (111 > 88)
self.loader.load()

@requests_mock.Mocker()
@pytest.mark.usefixtures(
"mock_lakefs_client_no_presign_local", "mock_unstructured_local"
)
def test_non_presigned_loading(self, mocker: Mocker) -> None:
mocker.register_uri(requests_mock.ANY, requests_mock.ANY, status_code=200)
loader = LakeFSLoader(
lakefs_access_key="lakefs_access_key",
lakefs_secret_key="lakefs_secret_key",
lakefs_endpoint=self.endpoint,
)
loader.set_repo(self.repo)
loader.set_ref(self.ref)
loader.set_path(self.path)
loader.load()
self.loader.load()

0 comments on commit af6c394

Please sign in to comment.