Best Python code snippet using localstack_python
test_request.py
Source:test_request.py
...82 assert request.content_length == 783def test_get_custom_headers():84 request = Request("GET", "/", body="foobar", headers={"x-amz-target": "foobar"})85 assert request.headers["x-amz-target"] == "foobar"86def test_get_raw_path():87 request = Request("GET", "/foo/bar/ed", raw_path="/foo%2Fbar/ed")88 assert request.path == "/foo/bar/ed"89 assert request.environ["RAW_URI"] == "/foo%2Fbar/ed"90 assert get_raw_path(request) == "/foo%2Fbar/ed"91def test_get_raw_path_with_query():92 request = Request("GET", "/foo/bar/ed", raw_path="/foo%2Fbar/ed?fizz=buzz")93 assert request.path == "/foo/bar/ed"94 assert request.environ["RAW_URI"] == "/foo%2Fbar/ed?fizz=buzz"95 assert get_raw_path(request) == "/foo%2Fbar/ed"96def test_headers_retain_dashes():97 request = Request("GET", "/foo/bar/ed", {"X-Amz-Meta--foo_bar-ed": "foobar"})98 assert "x-amz-meta--foo_bar-ed" in request.headers99 assert request.headers["x-amz-meta--foo_bar-ed"] == "foobar"100def test_headers_retain_case():...
test_config.py
Source:test_config.py
...31 def test_get_password(self):32 self.config_parser.get.return_value = '<password>'33 assert_that(self.config.get_password()).is_equal_to('<password>')34 assert_that(self.config_parser.mock_calls).contains(call.get('auth', 'password'))35 def test_get_raw_path(self):36 self.config_parser.get.return_value = '<raw_path>'37 assert_that(self.config.get_raw_path()).is_equal_to('<raw_path>')38 assert_that(self.config_parser.mock_calls).contains(call.get('path', 'raw'))39 def test_get_archive_path(self):40 self.config_parser.get.return_value = '<archive_path>'41 assert_that(self.config.get_archive_path()).is_equal_to('<archive_path>')42 assert_that(self.config_parser.mock_calls).contains(call.get('path', 'archive'))43 def test_get_db_connection_string(self):44 self.config_parser.get.side_effect = lambda *x: {45 ('db', 'host'): '<host>',46 ('db', 'dbname'): '<dbname>',47 ('db', 'username'): '<username>',48 ('db', 'password'): '<password>'}[x]49 assert_that(self.config.get_db_connection_string()) \...
test_data_path.py
Source:test_data_path.py
...4SUBJECTS = [1, 2, 3, 4, 5]5RUN_NUM = 16FWHM_MM = 87AGGREGATION = 'pooled'8def test_get_raw_path():9 paths = [dp.get_raw_path(subject, RUN_NUM) for subject in SUBJECTS]10 assert paths[0] == '{0}/data/raw/sub1_run1_raw.nii'.format(11 REPO_HOME_PATH)12 assert paths[1] == '{0}/data/raw/sub2_run1_raw.nii'.format(13 REPO_HOME_PATH)14def test_get_concatenated_path():15 paths = [dp.get_concatenated_path(subject) for subject in SUBJECTS]16 assert paths[0] == '{0}/data/processed/sub1_rcds.npy'.format(REPO_HOME_PATH)17 assert paths[1] == '{0}/data/processed/sub2_rcds.npy'.format(REPO_HOME_PATH)18 assert paths[2] == '{0}/data/processed/sub3_rcds.npy'.format(REPO_HOME_PATH)19 assert paths[3] == '{0}/data/processed/sub4_rcds.npy'.format(REPO_HOME_PATH)20 assert paths[4] == '{0}/data/processed/sub5_rcds.npy'.format(REPO_HOME_PATH)21def test_get_smoothed_path():22 paths = [dp.get_smoothed_path(subject, FWHM_MM) for subject in SUBJECTS]...
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!!