Skip to content

Commit 6e3a448

Browse files
authored
Fix weviate auth and add int test (#266)
1 parent 444f7d5 commit 6e3a448

File tree

4 files changed

+41
-5
lines changed

4 files changed

+41
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.3.3-dev1
1+
## 0.3.3-dev2
22

33
### Enhancements
44

@@ -8,6 +8,7 @@
88

99
* **Make AstraDB uploader truncate `text` and `text_as_html` content to max 8000 bytes**
1010
* **Add missing LanceDb extra**
11+
* **Weaviate cloud auth detection fixed**
1112

1213
## 0.3.2
1314

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import pytest
2+
from pydantic import ValidationError
3+
4+
from unstructured_ingest.v2.processes.connectors.weaviate.cloud import (
5+
CloudWeaviateAccessConfig,
6+
CloudWeaviateConnectionConfig,
7+
)
8+
9+
10+
def test_weaviate_failing_connection_config():
11+
with pytest.raises(ValidationError):
12+
CloudWeaviateConnectionConfig(
13+
access_config=CloudWeaviateAccessConfig(api_key="my key", password="password"),
14+
username="username",
15+
cluster_url="clusterurl",
16+
)
17+
18+
19+
def test_weaviate_connection_config_happy_path():
20+
CloudWeaviateConnectionConfig(
21+
access_config=CloudWeaviateAccessConfig(
22+
api_key="my key",
23+
),
24+
cluster_url="clusterurl",
25+
)
26+
27+
28+
def test_weaviate_connection_config_anonymous():
29+
CloudWeaviateConnectionConfig(
30+
access_config=CloudWeaviateAccessConfig(api_key="my key", password="password"),
31+
username="username",
32+
anonymous=True,
33+
cluster_url="clusterurl",
34+
)

unstructured_ingest/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.3-dev1" # pragma: no cover
1+
__version__ = "0.3.3-dev2" # pragma: no cover

unstructured_ingest/v2/processes/connectors/weaviate/cloud.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ def model_post_init(self, __context: Any) -> None:
5555
"client_secret": access_config.client_secret is not None,
5656
"client_password": access_config.password is not None and self.username is not None,
5757
}
58-
if len(auths) == 0:
58+
existing_auths = [auth_method for auth_method, flag in auths.items() if flag]
59+
60+
if len(existing_auths) == 0:
5961
raise ValueError("No auth values provided and anonymous is False")
60-
if len(auths) > 1:
61-
existing_auths = [auth_method for auth_method, flag in auths.items() if flag]
62+
if len(existing_auths) > 1:
6263
raise ValueError(
6364
"Multiple auth values provided, only one approach can be used: {}".format(
6465
", ".join(existing_auths)

0 commit comments

Comments
 (0)