66from test .integration .connectors .utils .validation .source import (
77 SourceValidationConfigs ,
88 source_connector_validation ,
9- source_filedata_display_name_set_check ,
109)
1110from test .integration .utils import requires_env
1211from unstructured_ingest .processes .connectors .confluence import (
2322@pytest .mark .asyncio
2423@pytest .mark .tags (CONNECTOR_TYPE , SOURCE_TAG , UNCATEGORIZED_TAG )
2524@requires_env ("CONFLUENCE_USER_EMAIL" , "CONFLUENCE_API_TOKEN" )
26- async def test_confluence_source (temp_dir ):
27- # Retrieve environment variables
28- confluence_url = "https://unstructured-ingest-test.atlassian.net"
29- user_email = os .environ ["CONFLUENCE_USER_EMAIL" ]
30- api_token = os .environ ["CONFLUENCE_API_TOKEN" ]
31- spaces = ["testteamsp" , "MFS" ]
32-
33- # Create connection and indexer configurations
34- access_config = ConfluenceAccessConfig (api_token = api_token )
35- connection_config = ConfluenceConnectionConfig (
36- url = confluence_url ,
37- username = user_email ,
38- access_config = access_config ,
39- )
40- index_config = ConfluenceIndexerConfig (
41- max_num_of_spaces = 500 ,
42- max_num_of_docs_from_each_space = 100 ,
43- spaces = spaces ,
44- )
45-
46- download_config = ConfluenceDownloaderConfig (download_dir = temp_dir )
47-
48- # Instantiate indexer and downloader
49- indexer = ConfluenceIndexer (
50- connection_config = connection_config ,
51- index_config = index_config ,
52- )
53- downloader = ConfluenceDownloader (
54- connection_config = connection_config ,
55- download_config = download_config ,
56- )
57-
58- # Run the source connector validation
59- await source_connector_validation (
60- indexer = indexer ,
61- downloader = downloader ,
62- configs = SourceValidationConfigs (
63- test_id = "confluence" ,
64- expected_num_files = 11 ,
65- validate_downloaded_files = True ,
66- predownload_file_data_check = source_filedata_display_name_set_check ,
67- postdownload_file_data_check = source_filedata_display_name_set_check ,
68- ),
69- )
70-
71-
72- @pytest .mark .asyncio
73- @pytest .mark .tags (CONNECTOR_TYPE , SOURCE_TAG , UNCATEGORIZED_TAG )
74- @requires_env ("CONFLUENCE_USER_EMAIL" , "CONFLUENCE_API_TOKEN" )
75- async def test_confluence_source_large (temp_dir ):
76- # Retrieve environment variables
25+ @pytest .mark .parametrize (
26+ "spaces,max_num_of_spaces,max_num_of_docs_from_each_space,expected_num_files,validate_downloaded_files,validate_file_data,test_id" ,
27+ [
28+ (["testteamsp" , "MFS" ], 500 , 100 , 11 , True , True , "confluence" ),
29+ (["testteamsp" ], 500 , 1 , 1 , True , True , "confluence_limit" ),
30+ (["testteamsp1" ], 10 , 301 , 301 , False , False , "confluence_large" ),
31+ ],
32+ )
33+ async def test_confluence_source_param (
34+ temp_dir ,
35+ spaces ,
36+ max_num_of_spaces ,
37+ max_num_of_docs_from_each_space ,
38+ expected_num_files ,
39+ validate_downloaded_files ,
40+ validate_file_data ,
41+ test_id ,
42+ ):
43+ """
44+ Integration test for the Confluence source connector using various space and document limits.
45+ """
7746 confluence_url = "https://unstructured-ingest-test.atlassian.net"
7847 user_email = os .environ ["CONFLUENCE_USER_EMAIL" ]
7948 api_token = os .environ ["CONFLUENCE_API_TOKEN" ]
80- spaces = ["testteamsp1" ]
8149
82- # Create connection and indexer configurations
8350 access_config = ConfluenceAccessConfig (api_token = api_token )
8451 connection_config = ConfluenceConnectionConfig (
8552 url = confluence_url ,
8653 username = user_email ,
8754 access_config = access_config ,
8855 )
8956 index_config = ConfluenceIndexerConfig (
90- max_num_of_spaces = 10 ,
91- max_num_of_docs_from_each_space = 250 ,
57+ max_num_of_spaces = max_num_of_spaces ,
58+ max_num_of_docs_from_each_space = max_num_of_docs_from_each_space ,
9259 spaces = spaces ,
9360 )
94-
9561 download_config = ConfluenceDownloaderConfig (download_dir = temp_dir )
9662
97- # Instantiate indexer and downloader
9863 indexer = ConfluenceIndexer (
9964 connection_config = connection_config ,
10065 index_config = index_config ,
@@ -104,15 +69,13 @@ async def test_confluence_source_large(temp_dir):
10469 download_config = download_config ,
10570 )
10671
107- # Run the source connector validation
10872 await source_connector_validation (
10973 indexer = indexer ,
11074 downloader = downloader ,
11175 configs = SourceValidationConfigs (
112- test_id = "confluence_large" ,
113- expected_num_files = 301 ,
114- validate_file_data = False ,
115- predownload_file_data_check = source_filedata_display_name_set_check ,
116- postdownload_file_data_check = source_filedata_display_name_set_check ,
76+ test_id = test_id ,
77+ expected_num_files = expected_num_files ,
78+ validate_downloaded_files = validate_downloaded_files ,
79+ validate_file_data = validate_file_data
11780 ),
118- )
81+ )
0 commit comments