Best Python code snippet using localstack_python
fabfile.py
Source:fabfile.py
...14 # cliqz.cli.put('conf/luigi.cfg', '/etc/luigi/client.cfg', True)15 cliqz.cli.restart_service('luigid', 5)16@task17def full_install(host_details=None):18 prepare_host()19 install_luigi()20 deploy_app()21@task22def prepare_host(host_details=None):23 # set up locale24 run("echo 'export LC_ALL=\"en_US.UTF-8\"' >> /etc/environment")25 run("echo 'export AWS_DEFAULT_REGION=\"us-east-1\"' >> /etc/environment")26 cliqz.cli.system_package('python-pip', 'gcc', 'make', 'python-dev', 'git',27 'libevent-dev', 'emacs', 'zip')28 cliqz.cli.python_package('ipython', 'ujson', 'luigi', 'pyyaml', 'boto', 'requests', 'requests[security]')29@task30def deploy_app():31 pkg = cliqz.package.gen_definition()32 with settings(host_string='localhost'):33 local("tar cjf {} load_filters".format(pkg['local']))34 cliqz.package.install(pkg, '/opt/load_filters')35 add_crontab()36@task...
test_dataManipulate.py
Source:test_dataManipulate.py
...39 host_name = "hostpl"40 self.assertFalse(self.dm.is_valid_host_name(host_name))41 def test_get_host_dict_from_csv(self):42 expected_value = {43 "host1.com": self.prepare_host([3063.33, 9618.39, 19707.9, 3]),44 "host2.com": self.prepare_host([1301.62, 1301.62, 1301.62, 1]),45 "host4.com": self.prepare_host([6647.35, 9203.05, 24547.58, 3]),46 "host5.com": self.prepare_host([1812.97, 1812.97, 1812.97, 1]),47 "host7.com": self.prepare_host([1, 1, 1.0, 1]),48 }49 fh = FileHandler(input_path="testInput.csv", output_path="")50 dm = DataManipulate(fh)51 dict_res = dm.get_host_dict_from_csv()52 for key in dict_res.keys():53 self.assertEqual(dict_res[key], expected_value[key], msg="%s %s == %s" % (key, dict_res[key], expected_value[key]))54 self.assertFalse("host6.com" in dict_res.keys())55 def prepare_host(self, params):56 host = Host(1)57 host.hMin = params[0]58 host.hMax = params[1]59 host.hSum = params[2]60 host.hCount = params[3]...
server.py
Source:server.py
...20# TODO: Verify request21async def tarball_ready(request: Request) -> Response:22 return await handlers.tarball_ready_event(request)23# TODO: Verify request24async def prepare_host(request: Request) -> Response:25 return await handlers.prepare_host(request)26# TODO: Verify request27async def deploy_host(request: Request) -> Response:28 return await handlers.deploy_host(request)29async def status(request: Request) -> Response:30 return Response(b"")31async def error(request: Request) -> Response:32 raise RuntimeError("Testing exception")33def get_app(*, master: bool, sentry: bool = True) -> ASGIFramework:34 asgi_app = Starlette(35 debug=True,36 routes=(37 [38 Route("/github-webhook", github_webhook, methods=["POST"]),39 Route("/tarball-ready", tarball_ready, methods=["POST"]),...
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!!