def test_get_attachment_unsupported_type(client): """ Given: - raw response returned from get_attachment_command When: - response type is itemAttachment with attachment that is not supported Then: - Validate the human readable which explain we do not support the type """ with open('test_data/mail_with_unsupported_attachment') as mail_json: user_id = '*****@*****.**' raw_response = json.load(mail_json) res = item_result_creator(raw_response, user_id) assert isinstance(res, CommandResults) output = res.to_context().get('HumanReadable', '') assert 'Integration does not support attachments from type #microsoft.graph.contact' in output
def test_get_attachment(client): """ Given: - raw response returned from get_attachment_command When: - response type is itemAttachment and 'item_result_creator' is called Then: - Validate that the message object created successfully """ output_prefix = 'MSGraphMail(val.ID == obj.ID)' with open('test_data/mail_with_attachment') as mail_json: user_id = '*****@*****.**' raw_response = json.load(mail_json) res = item_result_creator(raw_response, user_id) assert isinstance(res, CommandResults) output = res.to_context().get('EntryContext', {}) assert output.get(output_prefix).get('ID') == 'exampleID' assert output.get(output_prefix).get('Subject') == 'Test it'