How to use parse_additional_flags method in localstack

Best Python code snippet using localstack_python

test_dockerclient.py

Source:test_dockerclient.py Github

copy

Full Screen

...52 )53 env_vars = {}54 ports = PortMappings()55 mounts = []56 Util.parse_additional_flags(argument_string, env_vars, ports, mounts)57 assert env_vars == {"TEST_ENV_VAR": "test_string=123"}58 assert ports.to_str() == "-p 80:8080/udp -p 6000:7000"59 assert mounts == [("/var/test", "/opt/test")]60 argument_string = (61 "--add-host host.docker.internal:host-gateway --add-host arbitrary.host:127.0.0.1"62 )63 _, _, _, extra_hosts, _ = Util.parse_additional_flags(argument_string, env_vars, ports, mounts)64 assert {"host.docker.internal": "host-gateway", "arbitrary.host": "127.0.0.1"} == extra_hosts65 with pytest.raises(NotImplementedError):66 argument_string = "--somerandomargument"67 Util.parse_additional_flags(argument_string, env_vars, ports, mounts)68 with pytest.raises(ValueError):69 argument_string = "--publish 80:80:80:80"70 Util.parse_additional_flags(argument_string, env_vars, ports, mounts)71 # Test windows paths72 argument_string = r'-v "C:\Users\SomeUser\SomePath:/var/task"'73 _, _, mounts, _, _ = Util.parse_additional_flags(argument_string)74 assert mounts == [(r"C:\Users\SomeUser\SomePath", "/var/task")]75 argument_string = r'-v "C:\Users\SomeUser\SomePath:/var/task:ro"'76 _, _, mounts, _, _ = Util.parse_additional_flags(argument_string)77 assert mounts == [(r"C:\Users\SomeUser\SomePath", "/var/task")]78 argument_string = r'-v "C:\Users\Some User\Some Path:/var/task:ro"'79 _, _, mounts, _, _ = Util.parse_additional_flags(argument_string)80 assert mounts == [(r"C:\Users\Some User\Some Path", "/var/task")]81 argument_string = r'-v "/var/test:/var/task:ro"'82 _, _, mounts, _, _ = Util.parse_additional_flags(argument_string)83 assert mounts == [("/var/test", "/var/task")]84 # Test file paths85 argument_string = r'-v "/tmp/test.jar:/tmp/foo bar/test.jar"'86 _, _, mounts, _, _ = Util.parse_additional_flags(argument_string)87 assert mounts == [(r"/tmp/test.jar", "/tmp/foo bar/test.jar")]88 argument_string = r'-v "/tmp/test-foo_bar.jar:/tmp/test-foo_bar2.jar"'89 _, _, mounts, _, _ = Util.parse_additional_flags(argument_string)90 assert mounts == [(r"/tmp/test-foo_bar.jar", "/tmp/test-foo_bar2.jar")]91 # Test file paths92 argument_string = r'-v "/tmp/test.jar:/tmp/foo bar/test.jar" --network mynet123'93 _, _, _, _, network = Util.parse_additional_flags(argument_string)94 assert network == "mynet123"95def list_in(a, b):96 return len(a) <= len(b) and any(97 map(lambda x: b[x : x + len(a)] == a, range(len(b) - len(a) + 1))...

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