Best Python code snippet using localstack_python
test_oci_export_facts.py
Source:test_oci_export_facts.py
...43):44 module = get_module(dict({"compartment_id": "ocid1.compartment.aaaa"}))45 list_all_resources_patch.return_value = get_exports()46 file_storage_client.get_export.side_effect = [47 get_response(200, None, get_export(), None),48 get_response(200, None, get_export(), None),49 ]50 result = oci_export_facts.list_exports(file_storage_client, module)51 assert len(result["exports"]) is 252def test_list_exports_list_all_by_file_system_id(53 file_storage_client, list_all_resources_patch54):55 module = get_module(dict({"file_system_id": "ocid1.filesystem.aaaa"}))56 list_all_resources_patch.return_value = get_exports()57 file_storage_client.get_export.side_effect = [58 get_response(200, None, get_export(), None),59 get_response(200, None, get_export(), None),60 ]61 result = oci_export_facts.list_exports(file_storage_client, module)62 assert len(result["exports"]) is 263def test_list_exports_list_all_by_export_set_id(64 file_storage_client, list_all_resources_patch65):66 module = get_module(dict({"export_set_id": "ocid1.exportset.aaaa"}))67 list_all_resources_patch.return_value = get_exports()68 file_storage_client.get_export.side_effect = [69 get_response(200, None, get_export(), None),70 get_response(200, None, get_export(), None),71 ]72 result = oci_export_facts.list_exports(file_storage_client, module)73 assert len(result["exports"]) is 274def test_list_exports_list_specific(file_storage_client):75 module = get_module(dict({"export_id": "ocid1.export.aaaa"}))76 file_storage_client.get_export.return_value = get_response(77 200, None, get_export(), None78 )79 result = oci_export_facts.list_exports(file_storage_client, module)80 assert result["exports"][0]["lifecycle_state"] is "ACTIVE"81def test_list_exports_service_error(file_storage_client):82 error_message = "Internal Server Error"83 module = get_module(dict({"export_id": "ocid1.export.aaaa"}))84 file_storage_client.get_export.side_effect = ServiceError(85 499, "InternalServerError", dict(), error_message86 )87 try:88 oci_export_facts.list_exports(file_storage_client, module)89 except Exception as ex:90 assert error_message in ex.args[0]91def get_exports():92 exports = []93 export1 = Export()94 export1.lifecycle_state = "ACTIVE"95 export2 = Export()96 export2.lifecycle_state = "CREATING"97 exports.append(export1)98 exports.append(export2)99 return exports100def get_export():101 export = Export()102 export.lifecycle_state = "ACTIVE"103 return export104def get_response(status, header, data, request):105 return oci.Response(status, header, data, request)106def get_module(additional_properties):107 params = dict()108 params.update(additional_properties)109 module = FakeModule(**params)...
create-job-definition.py
Source:create-job-definition.py
...3import json4cfn = boto3.client('cloudformation')5exports = cfn.list_exports()['Exports']6# retrieve export values that are needed for configuring nextflow7def get_export(exports, name):8 for export in exports:9 if '-' + name in export['Name']:10 return {name: export['Value']}11jobdef = {12 "jobDefinitionName": "nextflow",13 "type": "container",14 "containerProperties": {15 "image": get_export(exports, 'NextflowContainerImage'),16 "vcpus": 2,17 "memory": 1024,18 "jobRoleArn": get_export(exports, 'NextflowJobRoleArn'),19 "environment": [20 {21 "name": "NF_LOGSDIR",22 "value": get_export(exports, 'NextflowLogsDir')23 },24 {25 "name": "NF_JOB_QUEUE",26 "value": get_export(exports, 'DefaultJobQueue')27 },28 {29 "name": "NF_WORKDIR",30 "value": get_export(exports, 'NextflowWorkDir')31 }32 ]33 }34}...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!