How to use merge_properties method in localstack

Best Python code snippet using localstack_python

test_context.py

Source:test_context.py Github

copy

Full Screen

...80 'prop2': 'http-prop2',81 'prop3': 'http-prop3'82 }83 assert EXPECTED_PROPS == p84def test_merge_properties(ctx, command_descr):85 cmd = ctx.merge_properties(command_descr, 'group1')86 p = cmd.props87 assert 'a simple lonely prop' == p['prop2']88 assert 'www.plan-group1-plugin.com' == p['host']89 assert not p['secure']90 assert 2311 == p['timeout']91 assert 200 == p['prop1']92def test_merge_properties_command_should_override_plan(ctx, command_descr):93 cmd = ctx.merge_properties(command_descr, plan_group='pgroup1', command_group='cgroup1')94 p = cmd.props95 assert not p['debug']96 assert 20 == p['delay']97def test_merge_properties_command_should_override_plan_with_plugin(ctx, command_descr):98 cmd = ctx.merge_properties(command_descr, plan_group='pgroup1', command_group='cgroup1')99 p = cmd.props100 assert not p['debug']101 assert 20 == p['delay']102 assert 'www.command-cgroup1-env-plugin.com' == p['host']103def test_merge_properties_command_should_override_global(ctx_with_global_properties, command_descr):104 cmd = ctx_with_global_properties.merge_properties(command_descr, plan_group='pgroup1', command_group='cgroup1')105 p = cmd.props106 assert 'host.commanscoped.com' == p['host']107 assert 1789 == p['timeout']108def test_merge_properties_command_should_override_global_with_env(ctx_with_global_properties, command_descr):109 cmd = ctx_with_global_properties.merge_properties(command_descr, plan_group='pgroup1', command_group='cgroup2')110 p = cmd.props111 assert 2999 == p['timeout']...

Full Screen

Full Screen

test_time.py

Source:test_time.py Github

copy

Full Screen

1from unittest.mock import MagicMock2from unittest.mock import call3from genloppy.processor.base import BaseOutput4from genloppy.processor.time import Time5def test_01_base_output_subclass():6 """Tests that pretend processor is BaseOutput subclass.7 tests: R-PROCESSOR-PRETEND-001"""8 assert issubclass(Time, BaseOutput)9def test_02_initialization():10 """Tests initialization of the time processor.11 tests: R-PROCESSOR-TIME-002"""12 time = Time(output=None)13 assert time.mode is time.MODES.package14 time = Time(output=None, active_filter={"search_reg_exps", })15 assert time.mode is time.MODES.search16def test_03_pre_processing():17 """Tests that merge processor calls message with the expected pre-processing text.18 tests: R-PROCESSOR-TIME-003"""19 m = MagicMock()20 time = Time(output=m, active_filter={"search_reg_exps", })21 time.pre_process()22 assert m.method_calls == [call.message(" * matches found:\n")]23 m.reset_mock()24 time = Time(output=m)25 time.pre_process()26 assert not m.method_calls27def test_04_callbacks():28 """Tests that time processor added callbacks.29 tests: R-PROCESSOR-TIME-004"""30 time = Time(output=None)31 assert "merge_begin" in time.callbacks32 assert "merge_end" in time.callbacks33 assert time.callbacks["merge_begin"] is not None34 assert time.callbacks["merge_end"] is not None35 time = Time(output=None, active_filter={"search_reg_exps", })36 assert "merge_begin" in time.callbacks37 assert "merge_end" in time.callbacks38 assert time.callbacks["merge_begin"] is not None39 assert time.callbacks["merge_end"] is not None40def test_05_search_mode():41 """Tests that in search mode merge time items are printed directly.42 tests: R-PROCESSOR-TIME-00643 tests: R-PROCESSOR-TIME-007"""44 m = MagicMock()45 time = Time(output=m, active_filter={"search_reg_exps", })46 merge_properties = dict(timestamp=3679157, atom="cat/package-3.2.1", atom_base="cat/package", atom_version="3.2.1",47 count_n="11",48 count_m="23")49 time.process_search(merge_properties, 3677820)50 time.post_process()51 assert m.method_calls == [call.merge_time_item(merge_properties["timestamp"], merge_properties["atom_base"],52 merge_properties["atom_version"], 3677820)]53def test_06_package_mode():54 """Tests that in package mode merge time items are collected and printed afterwards.55 tests: R-PROCESSOR-TIME-00556 tests: R-PROCESSOR-TIME-007"""57 m = MagicMock()58 time = Time(output=m)59 merge_properties = [60 dict(timestamp=1, atom="cat/package-3.2.1", atom_base="cat/package", atom_version="3.2.1", count_n="11",61 count_m="23"),62 dict(timestamp=2, atom="abc/package-0.47.11", atom_base="abc/package", atom_version="0.47.11", count_n="7",63 count_m="9"),64 dict(timestamp=3, atom="cat/package-3.1.1", atom_base="cat/package", atom_version="3.1.1", count_n="1",65 count_m="1")]66 for merge_property in merge_properties:67 time.process_package(merge_property, 50)68 time.post_process()69 assert m.method_calls == [call.message(" * {}:\n".format(merge_properties[1]["atom_base"])),70 call.merge_time_item(merge_properties[1]["timestamp"], merge_properties[1]["atom_base"],71 merge_properties[1]["atom_version"], 50),72 call.message(" * {}:\n".format(merge_properties[0]["atom_base"])),73 call.merge_time_item(merge_properties[0]["timestamp"], merge_properties[0]["atom_base"],74 merge_properties[0]["atom_version"], 50),75 call.merge_time_item(merge_properties[2]["timestamp"], merge_properties[2]["atom_base"],76 merge_properties[2]["atom_version"], 50),...

Full Screen

Full Screen

erb.py

Source:erb.py Github

copy

Full Screen

...69 'user': 'admin',70 'password': ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(12))71 }72 return properties73def merge_properties(properties, new_properties):74 for p in new_properties:75 if properties.get(p, None) is None:76 properties[p] = new_properties[p]77def merge_property_array(properties, new_properties):78 for p in new_properties:79 name = p['name']80 if properties.get(name, None) is None:81 value = p.get('value', p.get('default', None))82 if value is not None:83 properties[name] = value84def compile_config(config_dir):85 properties = {}86 config1 = get_file_properties(os.path.join(config_dir, 'tile.yml'))87 config2 = get_file_properties(os.path.join(config_dir, 'missing-properties.yml'))88 merge_properties(properties, get_cf_properties())89 merge_properties(properties, config1)90 merge_property_array(properties, config1.get('properties', []))91 for form in config1.get('forms', []):92 merge_property_array(properties, form.get('properties', []))93 for package in config1.get('packages', []):94 merge_properties(package, config2.get(package['name'], {}))95 merge_properties(package, properties['security'])96 merge_properties(properties, { package['name'].replace('-','_'): package })97 merge_properties(properties, config2)98 for collection_form in config1.get('service_plan_forms', []):99 merge_property_array(properties, form.get('properties', []))100 return {101 'properties': properties,102 'JSON': { 'dump': json.dumps },103 'plans': properties.get('dynamic_service_plans', {}),104 'service_plan_forms': properties.get('service_plan_forms', {})...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful