|
30 | 30 | ASSETS_FETCH_FROM = '90 days'
|
31 | 31 | MIN_ASSETS_INTERVAL = 59
|
32 | 32 | HOST_LIMIT = 1000
|
| 33 | +TEST_FROM_DATE = 'one day' |
33 | 34 |
|
34 | 35 | ASSETS_DATE_FORMAT = '%Y-%m-%d'
|
35 | 36 | DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ" # ISO8601 format with UTC, default in XSOAR
|
|
1304 | 1305 | "qualys-virtual-host-manage": {
|
1305 | 1306 | "args": ["action", "ip", "network_id", "port", "fqdn"],
|
1306 | 1307 | },
|
1307 |
| - "test-module": {"args": []}, |
| 1308 | + "test-module": {"args": ["launched_after_datetime"]}, |
1308 | 1309 | "qualys-host-list-detection": {
|
1309 | 1310 | "args": [
|
1310 | 1311 | "ids",
|
@@ -3048,23 +3049,27 @@ def test_module(client: Client, params: dict[str, Any], first_fetch_time: str) -
|
3048 | 3049 | Returns:
|
3049 | 3050 | str: 'ok' if test passed, anything else will raise an exception and will fail the test.
|
3050 | 3051 | """
|
3051 |
| - build_args_dict(None, COMMANDS_ARGS_DATA["test-module"], False) |
3052 |
| - client.command_http_request(COMMANDS_API_DATA["test-module"]) |
3053 |
| - |
3054 |
| - if params.get('isFetchEvents'): |
3055 |
| - fetch_events( |
3056 |
| - client=client, |
3057 |
| - last_run={}, |
3058 |
| - first_fetch_time=first_fetch_time, |
3059 |
| - max_fetch=1, |
3060 |
| - fetch_function=get_activity_logs_events, |
3061 |
| - newest_event_field=ACTIVITY_LOGS_NEWEST_EVENT_DATETIME, |
3062 |
| - next_page_field=ACTIVITY_LOGS_NEXT_PAGE, |
3063 |
| - previous_run_time_field=ACTIVITY_LOGS_SINCE_DATETIME_PREV_RUN, |
3064 |
| - ) |
3065 |
| - if params.get('isFetchAssets'): |
3066 |
| - since_datetime = arg_to_datetime('3 days').strftime(ASSETS_DATE_FORMAT) # type: ignore[union-attr] |
3067 |
| - fetch_assets(client=client, since_datetime=since_datetime) |
| 3052 | + is_fetch_events = params.get('isFetchEvents') or False |
| 3053 | + is_fetch_assets = params.get('isFetchAssets') or False |
| 3054 | + |
| 3055 | + if is_fetch_assets or is_fetch_events: |
| 3056 | + if is_fetch_events: |
| 3057 | + fetch_events( |
| 3058 | + client=client, |
| 3059 | + last_run={}, |
| 3060 | + first_fetch_time=first_fetch_time, |
| 3061 | + max_fetch=1, |
| 3062 | + fetch_function=get_activity_logs_events, |
| 3063 | + newest_event_field=ACTIVITY_LOGS_NEWEST_EVENT_DATETIME, |
| 3064 | + next_page_field=ACTIVITY_LOGS_NEXT_PAGE, |
| 3065 | + previous_run_time_field=ACTIVITY_LOGS_SINCE_DATETIME_PREV_RUN, |
| 3066 | + ) |
| 3067 | + if is_fetch_assets: |
| 3068 | + since_datetime = arg_to_datetime('3 days').strftime(ASSETS_DATE_FORMAT) # type: ignore[union-attr] |
| 3069 | + fetch_assets(client=client, since_datetime=since_datetime) |
| 3070 | + else: |
| 3071 | + build_args_dict({'launched_after_datetime': TEST_FROM_DATE}, COMMANDS_ARGS_DATA["test-module"], False) |
| 3072 | + client.command_http_request(COMMANDS_API_DATA["test-module"]) |
3068 | 3073 |
|
3069 | 3074 | return 'ok'
|
3070 | 3075 |
|
|
0 commit comments