-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_basic.py
More file actions
85 lines (61 loc) · 2.58 KB
/
Copy pathtest_basic.py
File metadata and controls
85 lines (61 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""
Basic tests for python-alfresco-api package functionality.
"""
import pytest
def test_package_import():
"""Test that the main package can be imported."""
import python_alfresco_api
assert hasattr(python_alfresco_api, 'ClientFactory')
assert hasattr(python_alfresco_api, 'AuthUtil')
def test_client_factory_basic():
"""Test basic ClientFactory functionality."""
from python_alfresco_api import ClientFactory
factory = ClientFactory(base_url="http://localhost:8080")
assert factory.base_url == "http://localhost:8080"
# Test individual client creation
auth_client = factory.create_auth_client()
core_client = factory.create_core_client()
assert auth_client is not None
assert core_client is not None
def test_all_clients_creation():
"""Test that all clients can be created."""
from python_alfresco_api import ClientFactory
factory = ClientFactory(
base_url="http://localhost:8080",
username="admin",
password="admin"
)
clients = factory.create_all_clients()
expected_clients = ["auth", "core", "discovery", "search", "workflow", "model", "search_sql"]
for client_name in expected_clients:
assert client_name in clients
assert clients[client_name] is not None
def test_master_client():
"""Test master client with dot syntax."""
from python_alfresco_api import ClientFactory
factory = ClientFactory(base_url="http://localhost:8080")
master = factory.create_master_client()
# Test dot syntax access
assert hasattr(master, 'auth')
assert hasattr(master, 'core')
assert hasattr(master, 'search')
assert hasattr(master, 'workflow')
def test_pydantic_models():
"""Test that Pydantic models can be imported and used."""
from python_alfresco_api.models.alfresco_auth_models import TicketBody
from python_alfresco_api.models.alfresco_core_models import NodeBodyCreate
# Test model creation
ticket = TicketBody(userId="admin", password="admin")
assert ticket.userId == "admin"
node = NodeBodyCreate(name="test.txt", nodeType="cm:content")
assert node.name == "test.txt"
def test_events_module():
"""Test that events module is preserved and importable."""
from python_alfresco_api.events import AlfrescoEventClient
# Should be able to create client (even if it fails to connect)
try:
client = AlfrescoEventClient()
# Creation successful (connection may fail without server)
except Exception:
# Expected if no ActiveMQ/Event Gateway available
pass