Skip to content

Commit 98eadc4

Browse files
packs/GoogleDrive: rename test files
Signed-off-by: Gal Nakash <[email protected]>
1 parent 7a38f7e commit 98eadc4

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

Diff for: Packs/GoogleDrive/Integrations/GoogleDrive/GoogleDrive.py

+23-8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
'EXCEPTION_GENERIC': 'Exception handling a {} request: {}',
4242
'MODIFY_LABEL_SUCCESS': 'Modify label successfully assigned to {}.',
4343
'GET_LABEL_SUCCESS': 'Label successfully retrieved.',
44+
'GET_LABELS_SUCCESS': 'Labels successfully retrieved.',
4445
}
4546

4647
SCOPES: dict[str, list[str]] = {
@@ -152,7 +153,7 @@
152153
'GOOGLE_DRIVE_FILE_PERMISSION_HEADER': 'GoogleDrive.FilePermission',
153154
'FILE_PERMISSION': 'FilePermission',
154155

155-
'LABELS': 'DriveLabels'
156+
'LABELS': 'GoogleDrive.Labels'
156157

157158
}
158159

@@ -1240,9 +1241,12 @@ def modify_label_command(client: 'GSuiteClient', args: dict[str, str]) -> Comman
12401241
response,
12411242
headerTransform=pascalToSpace,
12421243
removeNull=False)
1244+
outputs_context = {
1245+
OUTPUT_PREFIX['LABELS']: response
1246+
}
12431247

12441248
return CommandResults(
1245-
outputs=response,
1249+
outputs=outputs_context,
12461250
readable_output=table_hr_md,
12471251
)
12481252

@@ -1256,13 +1260,22 @@ def get_file_labels_command(client: 'GSuiteClient', args: dict[str, str]) -> Com
12561260

12571261
response = client.http_request(url_suffix=url_suffix, method='GET', params=http_request_params)
12581262

1263+
outputs_context = {
1264+
OUTPUT_PREFIX['LABELS']: response,
1265+
OUTPUT_PREFIX['GOOGLE_DRIVE_FILE_HEADER']: {
1266+
OUTPUT_PREFIX['FILE']: {
1267+
'id': args.get('file_id'),
1268+
},
1269+
}
1270+
}
1271+
12591272
table_hr_md = tableToMarkdown(HR_MESSAGES['GET_LABEL_SUCCESS'].format(args.get('file_id')),
1260-
response,
1273+
response['labels'],
12611274
headerTransform=pascalToSpace,
12621275
removeNull=False)
12631276

12641277
return CommandResults(
1265-
outputs=response,
1278+
outputs=outputs_context,
12661279
readable_output=table_hr_md,
12671280
)
12681281

@@ -1280,11 +1293,13 @@ def get_labels_command(client: 'GSuiteClient', args: dict[str, str]) -> CommandR
12801293
OUTPUT_PREFIX['LABELS']: response
12811294
}
12821295

1283-
outputs: dict = {
1284-
OUTPUT_PREFIX['GOOGLE_DRIVE_DRIVE_HEADER']: outputs_context
1285-
}
1296+
table_hr_md = tableToMarkdown(HR_MESSAGES['GET_LABELS_SUCCESS'],
1297+
response['labels'],
1298+
headerTransform=pascalToSpace,
1299+
removeNull=False)
12861300
return CommandResults(
1287-
outputs=outputs
1301+
readable_output=table_hr_md,
1302+
outputs=outputs_context
12881303
)
12891304

12901305

Diff for: Packs/GoogleDrive/Integrations/GoogleDrive/GoogleDrive_test.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -785,16 +785,14 @@ def test_list_labels(self, mocker_http_request, gsuite_client):
785785
"""
786786
from GoogleDrive import get_labels_command
787787

788-
with open('test_data/list_labels_response.json.json', encoding='utf-8') as data:
788+
with open('test_data/list_labels_response.json', encoding='utf-8') as data:
789789
mock_response = json.load(data)
790790
mocker_http_request.return_value = mock_response
791791

792792
result = get_labels_command(gsuite_client, {})
793793

794-
assert 'GoogleDrive.Drive.DriveLabels' in result.outputs
795-
assert len(result.outputs['GoogleDrive.Drive.DriveLabels']) == 1
796-
797-
assert result.raw_response == mock_response
794+
assert 'GoogleDrive.Drive' in result.outputs
795+
assert len(result.outputs['GoogleDrive.Drive']['DriveLabels']) == 1
798796

799797

800798
@patch(MOCKER_HTTP_METHOD)
@@ -813,15 +811,15 @@ def test_modify_labels_command(self, mocker_http_request, gsuite_client):
813811
"""
814812
from GoogleDrive import modify_label_command
815813

816-
with open('test_data/modify_label_command_repsonse.json.json', encoding='utf-8') as data:
814+
with open('test_data/modify_label_command_response.json', encoding='utf-8') as data:
817815
mock_response = json.load(data)
818816
mocker_http_request.return_value = mock_response
819817

820818
args = {
821819
'field_id': 'test',
822820
'selection_label_id': 'test',
823821
'label_id': 'test',
824-
'file_id' : 'test'
822+
'file_id': 'test'
825823
}
826824
result = modify_label_command(gsuite_client, args)
827825

@@ -832,7 +830,6 @@ def test_modify_labels_command(self, mocker_http_request, gsuite_client):
832830

833831
assert HR_MESSAGES['MODIFY_LABEL_SUCCESS'].format(args.get('file_id')) in result.readable_output
834832

835-
836833
@patch(MOCKER_HTTP_METHOD)
837834
def test_file_permission_list_command_failure(self, mocker_http_request, gsuite_client):
838835
"""
@@ -1001,8 +998,7 @@ def test_upload_file_with_parent_command_success(self, mocker, gsuite_client):
1001998
args = {
1002999
'parent': 'test_parent',
10031000
'entry_id': 'test_entry_id',
1004-
'file_name': 'test_file_name',
1005-
'parent': 'test_parent'
1001+
'file_name': 'test_file_name'
10061002

10071003
}
10081004
file_upload_command(gsuite_client, args)

0 commit comments

Comments
 (0)