How to use _create_bucket method in localstack

Best Python code snippet using localstack_python

test_views.py

Source:test_views.py Github

copy

Full Screen

...3from src.database import db, Bucket, Item4class TestHomePage:5 def test_redirects_to_inbox_bucket_page(self, test_client):6 _create_inbox_bucket()7 _create_bucket(title="Shopping", description="Groceries we need")8 response = test_client.get("/", follow_redirects=True)9 assert response.status_code == 20010 assert b"Inbox" in response.data11 assert b"Shopping" in response.data12 assert b"<h2>Inbox</h2>" in response.data13 assert b"<p>Random things</p>" in response.data14 def test_no_inbox__404_error(self, test_client):15 response = test_client.get("/")16 assert response.status_code == 40417class TestBucketPage:18 def test_bucket_page(self, test_client):19 _create_inbox_bucket()20 bucket = _create_bucket(21 title="Shopping",22 description="Groceries we need",23 item_titles=["Tomatoes", "Carrots"],24 )25 response = test_client.get(f"/bucket/{bucket.id}/")26 assert response.status_code == 20027 assert b"Inbox" in response.data28 assert b"Shopping" in response.data29 assert b"<h2>Shopping</h2>" in response.data30 assert b"<p>Groceries we need</p>" in response.data31 assert b"<td>Tomatoes</td>" in response.data32 assert b"<td>Carrots</td>" in response.data33 def test_bucket_not_found__404_error(self, test_client):34 unknown_bucket_id = 935 response = test_client.get(f"/bucket/{unknown_bucket_id}/")36 assert response.status_code == 40437 def test_quick_create_item(self, test_client):38 bucket = _create_bucket(39 title="Shopping",40 description="Groceries we need",41 item_titles=["Tomatoes"],42 )43 response = test_client.post(f"/bucket/{bucket.id}/", data={"title": "Zucchini"})44 assert response.status_code == 20045 assert b"<td>Zucchini</td>" in response.data46 item = _get_item("Zucchini")47 assert item.bucket == bucket48 assert item.description is None49 assert item.created_time is not None50 assert item.due_date is None51 assert item.completed_time is None52 assert not item.flagged53 def test_title_not_provided__validation_error(self, test_client):54 bucket = _create_bucket()55 response = test_client.post(f"/bucket/{bucket.id}/", data={"title": ""})56 assert response.status_code == 20057 assert b"Enter a title." in response.data58 def test_title_too_long__validation_error(self, test_client):59 bucket = _create_bucket()60 response = test_client.post(f"/bucket/{bucket.id}/", data={"title": "a" * 129})61 assert response.status_code == 20062 assert b"No longer than 128 characters." in response.data63class TestCreateBucket:64 def test_create_bucket__get(self, test_client):65 response = test_client.get("/bucket/create/")66 assert response.status_code == 20067 def test_create_bucket__post(self, test_client):68 _create_inbox_bucket()69 response = test_client.post(70 "/bucket/create/",71 data={"title": "Shopping", "description": "List of groceries"},72 follow_redirects=True,73 )74 assert response.status_code == 20075 assert b"<h2>Shopping</h2>" in response.data76 bucket = _get_bucket("Shopping")77 assert bucket.title == "Shopping"78 assert bucket.description == "List of groceries"79 assert bucket.can_deactivate80 assert bucket.deactivated_time is None81 def test_title_not_provided__validation_error(self, test_client):82 response = test_client.post(83 "/bucket/create/",84 data={"title": "", "description": "List of groceries"},85 )86 assert response.status_code == 20087 assert b"Enter a title." in response.data88 def test_title_too_long__validation_error(self, test_client):89 response = test_client.post(90 "/bucket/create/",91 data={"title": "a" * 33, "description": "List of groceries"},92 )93 assert response.status_code == 20094 assert b"No longer than 32 characters." in response.data95 def test_title_already_exists__validation_error(self, test_client):96 _create_bucket(title="Shopping")97 response = test_client.post(98 "/bucket/create/",99 data={"title": "Shopping", "description": "List of groceries"},100 )101 assert response.status_code == 200102 assert b"Bucket title must be unique." in response.data103 def test_description_not_provided__validation_error(self, test_client):104 response = test_client.post(105 "/bucket/create/",106 data={"title": "Shopping", "description": ""},107 )108 assert response.status_code == 200109 assert b"Enter a description." in response.data110class TestUpdateBucket:111 def test_update_bucket__get(self, test_client):112 bucket = _create_bucket(title="Shopping")113 response = test_client.get(f"/bucket/{bucket.id}/update/")114 assert response.status_code == 200115 def test_update_bucket__post(self, test_client):116 bucket = _create_bucket(title="Shopping", description="List of groceries")117 response = test_client.post(118 f"/bucket/{bucket.id}/update/",119 data={"title": "Stuff to buy", "description": "I like shopping"},120 follow_redirects=True,121 )122 assert response.status_code == 200123 assert b"<h2>Stuff to buy</h2>" in response.data124 bucket = _get_bucket("Stuff to buy")125 assert bucket.title == "Stuff to buy"126 assert bucket.description == "I like shopping"127 assert bucket.can_deactivate128 assert bucket.deactivated_time is None129 def test_update_where_data_does_not_change(self, test_client):130 bucket = _create_bucket(title="Shopping", description="List of groceries")131 response = test_client.post(132 f"/bucket/{bucket.id}/update/",133 data={"title": "Shopping", "description": "List of groceries"},134 follow_redirects=True,135 )136 print(response.data)137 assert response.status_code == 200138 assert b"<h2>Shopping</h2>" in response.data139 bucket = _get_bucket("Shopping")140 assert bucket.title == "Shopping"141 assert bucket.description == "List of groceries"142 def test_title_not_provided__validation_error(self, test_client):143 bucket = _create_bucket(title="Shopping")144 response = test_client.post(145 f"/bucket/{bucket.id}/update/",146 data={"title": "", "description": "List of groceries"},147 )148 assert response.status_code == 200149 assert b"Enter a title." in response.data150 def test_title_too_long__validation_error(self, test_client):151 bucket = _create_bucket(title="Shopping")152 response = test_client.post(153 f"/bucket/{bucket.id}/update/",154 data={"title": "a" * 33, "description": "List of groceries"},155 )156 assert response.status_code == 200157 assert b"No longer than 32 characters." in response.data158 def test_title_already_exists__validation_error(self, test_client):159 _create_bucket(title="Stuff to buy")160 bucket = _create_bucket(title="Shopping")161 response = test_client.post(162 f"/bucket/{bucket.id}/update/",163 data={"title": "Stuff to buy", "description": "List of groceries"},164 )165 assert response.status_code == 200166 assert b"Bucket title must be unique." in response.data167 def test_description_not_provided__validation_error(self, test_client):168 bucket = _create_bucket(title="Shopping")169 response = test_client.post(170 f"/bucket/{bucket.id}/update/",171 data={"title": "Shopping", "description": ""},172 )173 assert response.status_code == 200174 assert b"Enter a description." in response.data175class TestCreateItem:176 def test_create_item__get(self, test_client):177 bucket = _create_bucket()178 response = test_client.get(f"/bucket/{bucket.id}/item/create/")179 assert response.status_code == 200180 def test_create_item__post(self, test_client):181 bucket = _create_bucket()182 response = test_client.post(183 f"/bucket/{bucket.id}/item/create/",184 data={185 "title": "Zucchini",186 "description": "Vegetable also known as a courgette",187 "due_date": "2020-01-30",188 "flagged": True,189 },190 follow_redirects=True,191 )192 assert response.status_code == 200193 assert b"Zucchini" in response.data194 item = _get_item("Zucchini")195 assert item.bucket == bucket196 assert item.description == "Vegetable also known as a courgette"197 assert item.created_time is not None198 assert item.due_date == date(2020, 1, 30)199 assert item.completed_time is None200 assert item.flagged201 def test_only_supplying_required_fields(self, test_client):202 bucket = _create_bucket()203 response = test_client.post(204 f"/bucket/{bucket.id}/item/create/",205 data={"title": "Zucchini"},206 follow_redirects=True,207 )208 assert response.status_code == 200209 assert b"<td>Zucchini</td>" in response.data210 item = _get_item("Zucchini")211 assert item.bucket == bucket212 assert item.description is None213 assert item.created_time is not None214 assert item.due_date is None215 assert item.completed_time is None216 assert not item.flagged217 def test_bucket_not_found__404_error(self, test_client):218 bucket_id = 9219 response = test_client.post(220 f"/bucket/{bucket_id}/item/create/",221 data={"title": "Zucchini"},222 follow_redirects=True,223 )224 assert response.status_code == 404225 def test_title_not_provided__validation_error(self, test_client):226 bucket = _create_bucket()227 response = test_client.post(f"/bucket/{bucket.id}/item/create/", data={"title": ""})228 assert response.status_code == 200229 assert b"Enter a title." in response.data230 def test_title_too_long__validation_error(self, test_client):231 bucket = _create_bucket()232 response = test_client.post(f"/bucket/{bucket.id}/item/create/", data={"title": "a" * 129})233 assert response.status_code == 200234 assert b"No longer than 128 characters." in response.data235 def test_due_date_invalid_format__validation_error(self, test_client):236 bucket = _create_bucket()237 response = test_client.post(238 f"/bucket/{bucket.id}/item/create/",239 data={"title": "Zucchini", "due_date": "20200130"},240 )241 assert response.status_code == 200242 assert b"Not a valid date value" in response.data243class TestUpdateItem:244 def test_update_item__get(self, test_client):245 bucket = _create_bucket()246 item = _create_item(bucket)247 response = test_client.get(f"/bucket/{bucket.id}/item/{item.id}/update/")248 assert response.status_code == 200249 def test_update_item__post(self, test_client):250 bucket = _create_bucket()251 item = _create_item(bucket, "Tomatoes")252 response = test_client.post(253 f"/bucket/{bucket.id}/item/{item.id}/update/",254 data={255 "title": "Zucchini",256 "description": "Vegetable also known as a courgette",257 "due_date": "2020-01-30",258 "flagged": True,259 },260 follow_redirects=True,261 )262 assert response.status_code == 200263 assert b"Zucchini" in response.data264 updated_item = _get_item("Zucchini")265 assert updated_item.id == item.id266 assert updated_item.bucket == bucket267 assert updated_item.description == "Vegetable also known as a courgette"268 assert updated_item.created_time is not None269 assert updated_item.due_date == date(2020, 1, 30)270 assert updated_item.completed_time is None271 assert updated_item.flagged272 def test_bucket_not_found__404_error(self, test_client):273 bucket = _create_bucket()274 item = _create_item(bucket)275 bucket_id = 9276 response = test_client.post(277 f"/bucket/{bucket_id}/item/{item.id}/update/",278 data={"title": "Zucchini"},279 follow_redirects=True,280 )281 assert response.status_code == 404282 def test_item_not_found__404_error(self, test_client):283 bucket = _create_bucket()284 item_id = 9285 response = test_client.post(286 f"/bucket/{bucket.id}/item/{item_id}/update/",287 data={"title": "Zucchini"},288 follow_redirects=True,289 )290 assert response.status_code == 404291 def test_title_not_provided__validation_error(self, test_client):292 bucket = _create_bucket()293 item = _create_item(bucket)294 response = test_client.post(295 f"/bucket/{bucket.id}/item/{item.id}/update/", data={"title": ""}296 )297 assert response.status_code == 200298 assert b"Enter a title." in response.data299 def test_title_too_long__validation_error(self, test_client):300 bucket = _create_bucket()301 item = _create_item(bucket)302 response = test_client.post(303 f"/bucket/{bucket.id}/item/{item.id}/update/", data={"title": "a" * 129}304 )305 assert response.status_code == 200306 assert b"No longer than 128 characters." in response.data307 def test_due_date_invalid_format__validation_error(self, test_client):308 bucket = _create_bucket()309 item = _create_item(bucket)310 response = test_client.post(311 f"/bucket/{bucket.id}/item/{item.id}/update/",312 data={"title": "Zucchini", "due_date": "20200130"},313 )314 assert response.status_code == 200315 assert b"Not a valid date value" in response.data316class TestCompleteItem:317 def test_complete_item(self, test_client):318 bucket = _create_bucket()319 tomatoes = _create_item(bucket, "Tomatoes")320 _create_item(bucket, "Carrots")321 response = test_client.get(322 f"/bucket/{bucket.id}/item/{tomatoes.id}/complete/",323 follow_redirects=True,324 )325 assert response.status_code == 200326 assert b"<td>Tomatoes</td>" not in response.data327 assert b"<td>Carrots</td>" in response.data328 item = _get_item("Tomatoes")329 assert item.completed_time is not None330 def test_item_not_found__404_error(self, test_client):331 bucket = _create_bucket()332 item_id = 9333 response = test_client.get(f"/bucket/{bucket.id}/item/{item_id}/complete/")334 assert response.status_code == 404335 def test_bucket_not_found__404_error(self, test_client):336 bucket = _create_bucket()337 item = _create_item(bucket)338 bucket_id = 9339 response = test_client.get(f"/bucket/{bucket_id}/item/{item.id}/complete/")340 assert response.status_code == 404341class TestItemDueDatePlusOneDay:342 def test_item_due_date_plus_one_day(self, test_client):343 bucket = _create_bucket()344 item = _create_item(bucket, "New house", due_date=date(2020, 1, 1))345 response = test_client.get(346 f"/bucket/{bucket.id}/item/{item.id}/due_date_plus_one_day/",347 follow_redirects=True,348 )349 assert response.status_code == 200350 item = _get_item("New house")351 assert item.due_date == date(2020, 1, 2)352 @patch("src.views.date")353 def test_no_due_date_set__due_date_is_tomorrow(self, mock_date_lib, test_client):354 bucket = _create_bucket()355 item = _create_item(bucket, "New house", due_date=None)356 mock_date_lib.today.return_value = date(2020, 1, 1)357 response = test_client.get(358 f"/bucket/{bucket.id}/item/{item.id}/due_date_plus_one_day/",359 follow_redirects=True,360 )361 assert response.status_code == 200362 item = _get_item("New house")363 assert item.due_date == date(2020, 1, 2)364 def test_item_not_found__404_error(self, test_client):365 bucket = _create_bucket()366 item_id = 9367 response = test_client.get(f"/bucket/{bucket.id}/item/{item_id}/due_date_plus_one_day/")368 assert response.status_code == 404369 def test_bucket_not_found__404_error(self, test_client):370 bucket = _create_bucket()371 item = _create_item(bucket)372 bucket_id = 9373 response = test_client.get(f"/bucket/{bucket_id}/item/{item.id}/due_date_plus_one_day/")374 assert response.status_code == 404375class TestFlagItem:376 def test_flag_item(self, test_client):377 bucket = _create_bucket()378 tomatoes = _create_item(bucket, "Tomatoes")379 response = test_client.get(380 f"/bucket/{bucket.id}/item/{tomatoes.id}/flag/",381 follow_redirects=True,382 )383 assert response.status_code == 200384 item = _get_item("Tomatoes")385 assert item.flagged386 def test_item_already_flagged__remains_flagged(self, test_client):387 bucket = _create_bucket()388 tomatoes = _create_item(bucket, "Tomatoes", flagged=True)389 response = test_client.get(390 f"/bucket/{bucket.id}/item/{tomatoes.id}/flag/",391 follow_redirects=True,392 )393 assert response.status_code == 200394 item = _get_item("Tomatoes")395 assert item.flagged396 def test_item_not_found__404_error(self, test_client):397 bucket = _create_bucket()398 item_id = 9399 response = test_client.get(f"/bucket/{bucket.id}/item/{item_id}/flag/")400 assert response.status_code == 404401 def test_bucket_not_found__404_error(self, test_client):402 bucket = _create_bucket()403 item = _create_item(bucket)404 bucket_id = 9405 response = test_client.get(f"/bucket/{bucket_id}/item/{item.id}/flag/")406 assert response.status_code == 404407class TestUnflagItem:408 def test_unflag_item(self, test_client):409 bucket = _create_bucket()410 tomatoes = _create_item(bucket, "Tomatoes", flagged=True)411 response = test_client.get(412 f"/bucket/{bucket.id}/item/{tomatoes.id}/unflag/",413 follow_redirects=True,414 )415 assert response.status_code == 200416 item = _get_item("Tomatoes")417 assert not item.flagged418 def test_item_not_flagged__remains_unflagged(self, test_client):419 bucket = _create_bucket()420 tomatoes = _create_item(bucket, "Tomatoes", flagged=False)421 response = test_client.get(422 f"/bucket/{bucket.id}/item/{tomatoes.id}/unflag/",423 follow_redirects=True,424 )425 assert response.status_code == 200426 item = _get_item("Tomatoes")427 assert not item.flagged428 def test_item_not_found__404_error(self, test_client):429 bucket = _create_bucket()430 item_id = 9431 response = test_client.get(f"/bucket/{bucket.id}/item/{item_id}/unflag/")432 assert response.status_code == 404433 def test_bucket_not_found__404_error(self, test_client):434 bucket = _create_bucket()435 item = _create_item(bucket)436 bucket_id = 9437 response = test_client.get(f"/bucket/{bucket_id}/item/{item.id}/unflag/")438 assert response.status_code == 404439class TestDeleteItem:440 def test_delete_item(self, test_client):441 bucket = _create_bucket()442 tomatoes = _create_item(bucket, "Tomatoes")443 _create_item(bucket, "Carrots")444 response = test_client.get(445 f"/bucket/{bucket.id}/item/{tomatoes.id}/delete/",446 follow_redirects=True,447 )448 assert response.status_code == 200449 assert b"<td>Tomatoes</td>" not in response.data450 assert b"<td>Carrots</td>" in response.data451 assert Item.query.get(tomatoes.id) is None452 def test_item_not_found__404_error(self, test_client):453 bucket = _create_bucket()454 item_id = 9455 response = test_client.get(f"/bucket/{bucket.id}/item/{item_id}/delete/")456 assert response.status_code == 404457 def test_bucket_not_found__404_error(self, test_client):458 bucket = _create_bucket()459 item = _create_item(bucket)460 bucket_id = 9461 response = test_client.get(f"/bucket/{bucket_id}/item/{item.id}/delete/")462 assert response.status_code == 404463def _create_inbox_bucket():464 return _create_bucket(title="Inbox", description="Random things")465def _create_bucket(466 title="Shopping",467 description="Groceries we need",468 item_titles=None,469):470 bucket = Bucket(title=title, description=description)471 for item_title in item_titles or list():472 bucket.items.append(Item(title=item_title))473 db.session.add(bucket)474 db.session.commit()475 return bucket476def _create_item(bucket, title="Task", description=None, due_date=None, flagged=False):477 item = Item(478 bucket=bucket,479 title=title,...

Full Screen

Full Screen

test_local_file_system_bucket.py

Source:test_local_file_system_bucket.py Github

copy

Full Screen

2from foundations_contrib.local_file_system_bucket import LocalFileSystemBucket3class TestLocalFileSystemBucket(unittest.TestCase):4 def test_string_upload(self):5 path = self._make_path()6 bucket = self._create_bucket(path)7 bucket.upload_from_string('some_number', '12323')8 with self._open_bucket_file(path, 'some_number') as file:9 self.assertEqual(b'12323', file.read())10 def test_string_upload_different_values(self):11 path = self._make_path()12 bucket = self._create_bucket(path)13 bucket.upload_from_string('some_float', '12.3')14 with self._open_bucket_file(path, 'some_float') as file:15 self.assertEqual(b'12.3', file.read())16 def test_existence(self):17 path = self._make_path()18 bucket = self._create_bucket(path)19 bucket.upload_from_string('some_float', '12.3')20 self.assertTrue(bucket.exists('some_float'))21 def test_existence_different_values(self):22 path = self._make_path()23 bucket = self._create_bucket(path)24 bucket.upload_from_string('dunno', 'uno')25 self.assertTrue(bucket.exists('dunno'))26 def test_existence_missing(self):27 path = self._make_path()28 bucket = self._create_bucket(path)29 self.assertFalse(bucket.exists('some_string'))30 def test_existence_missing_different_values(self):31 path = self._make_path()32 bucket = self._create_bucket(path)33 self.assertFalse(bucket.exists('box'))34 def test_file_upload(self):35 path = self._make_path()36 bucket = self._create_bucket(path)37 with self._make_temp_file() as file:38 file.write_and_flush(b'potatoes')39 file.seek(0)40 bucket.upload_from_file('some_number', file)41 with self._open_bucket_file(path, 'some_number') as file:42 self.assertEqual(b'potatoes', file.read())43 def test_file_upload_different_values(self):44 path = self._make_path()45 bucket = self._create_bucket(path)46 with self._make_temp_file() as file:47 file.write_and_flush(b'hello')48 file.seek(0)49 bucket.upload_from_file('some_float', file)50 with self._open_bucket_file(path, 'some_float') as file:51 self.assertEqual(b'hello', file.read())52 def test_string_download(self):53 path = self._make_path()54 bucket = self._create_bucket(path)55 bucket.upload_from_string('some_number', '12323')56 self.assertEqual(b'12323', bucket.download_as_string('some_number'))57 def test_string_download_different_values(self):58 path = self._make_path()59 bucket = self._create_bucket(path)60 bucket.upload_from_string('some_string', 'yup')61 self.assertEqual(b'yup', bucket.download_as_string('some_string'))62 def test_file_download(self):63 path = self._make_path()64 bucket = self._create_bucket(path)65 bucket.upload_from_string('some_string', 'yup')66 with self._make_temp_file() as file:67 bucket.download_to_file('some_string', file)68 self.assertEqual(b'yup', file.read())69 def test_file_download_different_values(self):70 path = self._make_path()71 bucket = self._create_bucket(path)72 bucket.upload_from_string('bags', 'are dangerous')73 with self._make_temp_file() as file:74 bucket.download_to_file('bags', file)75 self.assertEqual(b'are dangerous', file.read())76 def test_list_files(self):77 path = self._make_path()78 bucket = self._create_bucket(path)79 bucket.upload_from_string('a', 'b')80 bucket.upload_from_string('c', 'd')81 self.assertEqual(set(['a', 'c']), set(bucket.list_files('*')))82 def test_list_files_different_values(self):83 path = self._make_path()84 bucket = self._create_bucket(path)85 bucket.upload_from_string('a', 'b')86 bucket.upload_from_string('c', 'd')87 bucket.upload_from_string('d', 'd')88 bucket.upload_from_string('dead', 'd')89 self.assertEqual(set(['d', 'dead']), set(bucket.list_files('d*')))90 def test_removes_file(self):91 path = self._make_path()92 bucket = self._create_bucket(path)93 bucket.upload_from_string('some_number', '12323')94 bucket.remove('some_number')95 self.assertFalse(bucket.exists('some_number'))96 def test_removes_file_different_values(self):97 path = self._make_path()98 bucket = self._create_bucket(path)99 bucket.upload_from_string('some_other_number', '12323')100 bucket.remove('some_other_number')101 self.assertFalse(bucket.exists('some_other_number'))102 def test_moves_file(self):103 path = self._make_path()104 bucket = self._create_bucket(path)105 bucket.upload_from_string('some_number', '12323')106 bucket.move('some_number', 'some_other_number')107 self.assertEqual(108 b'12323', bucket.download_as_string('some_other_number'))109 def test_moves_file_different_name(self):110 path = self._make_path()111 bucket = self._create_bucket(path)112 bucket.upload_from_string('some_float', '12.33')113 bucket.move('some_float', 'some_other_float')114 self.assertEqual(115 b'12.33', bucket.download_as_string('some_other_float'))116 def _open_bucket_file(self, path, name):117 from os.path import join118 return open(join(path, name), 'rb')119 def _make_path(self):120 from uuid import uuid4121 return '/tmp/{}'.format(uuid4())122 def _create_bucket(self, path):123 return LocalFileSystemBucket(path)124 def _make_temp_file(self):125 from foundations_contrib.simple_tempfile import SimpleTempfile...

Full Screen

Full Screen

test_storage_s3.py

Source:test_storage_s3.py Github

copy

Full Screen

...31# POSSIBILITY OF SUCH DAMAGE.32#33import uuid34from moto import mock_s335def _create_bucket(app):36 app.doc_store.storage.s3.create_bucket(Bucket='edusign-storage')37@mock_s338def test_add(s3_app, sample_pdf_data, sample_binary_pdf_data):39 _create_bucket(s3_app)40 key = str(uuid.uuid4())41 s3_app.doc_store.storage.add(key, sample_pdf_data)42 assert list(s3_app.doc_store.storage.s3_bucket.objects.all())[0].key == key43@mock_s344def test_add_and_retrieve(s3_app, sample_pdf_data):45 _create_bucket(s3_app)46 key = str(uuid.uuid4())47 s3_app.doc_store.storage.add(key, sample_pdf_data)48 content = s3_app.doc_store.storage.get_content(key)49 assert content == sample_pdf_data50@mock_s351def test_add_update_and_retrieve(s3_app, sample_pdf_data, sample_pdf_data_2):52 _create_bucket(s3_app)53 key = str(uuid.uuid4())54 s3_app.doc_store.storage.add(key, sample_pdf_data)55 s3_app.doc_store.storage.update(key, sample_pdf_data_2)56 content = s3_app.doc_store.storage.get_content(key)57 assert content != sample_pdf_data58 assert content == sample_pdf_data_259@mock_s360def test_add_two_update_and_retrieve(s3_app, sample_pdf_data, sample_pdf_data_2):61 _create_bucket(s3_app)62 key1 = str(uuid.uuid4())63 key2 = str(uuid.uuid4())64 s3_app.doc_store.storage.add(key1, sample_pdf_data)65 s3_app.doc_store.storage.add(key2, sample_pdf_data_2)66 s3_app.doc_store.storage.update(key1, sample_pdf_data_2)67 content1 = s3_app.doc_store.storage.get_content(key1)68 content2 = s3_app.doc_store.storage.get_content(key2)69 assert content1 == sample_pdf_data_270 assert content1 == content271@mock_s372def test_add_and_remove(s3_app, sample_pdf_data):73 _create_bucket(s3_app)74 key = str(uuid.uuid4())75 s3_app.doc_store.storage.add(key, sample_pdf_data)76 s3_app.doc_store.storage.remove(key)77 assert len(list(s3_app.doc_store.storage.s3_bucket.objects.all())) == 078@mock_s379def test_add_2_and_remove_1(s3_app, sample_pdf_data, sample_pdf_data_2):80 _create_bucket(s3_app)81 key = str(uuid.uuid4())82 s3_app.doc_store.storage.add(key, sample_pdf_data)83 key2 = str(uuid.uuid4())84 s3_app.doc_store.storage.add(key2, sample_pdf_data_2)85 s3_app.doc_store.storage.remove(key)86 assert len(list(s3_app.doc_store.storage.s3_bucket.objects.all())) == 187 content2 = s3_app.doc_store.storage.get_content(key2)...

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