How to use append_last_modified_headers method in localstack

Best Python code snippet using localstack_python

test_s3.py

Source:test_s3.py Github

copy

Full Screen

...162 # abort multipart upload is a delete with the same query string as a complete multipart upload163 self.assertFalse(s3_listener.ProxyListenerS3.is_query_allowable('DELETE', 'uploadId'))164 self.assertFalse(s3_listener.ProxyListenerS3.is_query_allowable('DELETE', 'differentQueryString'))165 self.assertFalse(s3_listener.ProxyListenerS3.is_query_allowable('PUT', 'uploadId'))166 def test_append_last_modified_headers(self):167 xml_with_last_modified = ('<?xml version="1.0" encoding="UTF-8"?>'168 '<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">'169 ' <Name>thanos/Name>'170 ' <Contents>'171 ' <LastModified>2019-05-27T19:00:16.663Z</LastModified>'172 ' </Contents>'173 '</ListBucketResult>'174 )175 xml_without_last_modified = ('<?xml version="1.0" encoding="UTF-8"?>'176 '<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">'177 ' <Name>thanos/Name>'178 ' <Contents>'179 ' <NotLastModified>2019-05-27T19:00:16.663Z</NotLastModified>'180 ' </Contents>'181 '</ListBucketResult>'182 )183 # if there is a parsable date in XML <LastModified>, use it184 response = Response()185 s3_listener.append_last_modified_headers(response, content=xml_with_last_modified)186 self.assertEqual('Mon, 27 May 2019 19:00:16 GMT', response.headers.get('Last-Modified', ''))187 # otherwise, just fill the header with the currentdate188 # I will not test currentDate as it is not trivial without adding dependencies189 # so, I'm testing for the presence of the header only190 response = Response()191 s3_listener.append_last_modified_headers(response, content=xml_without_last_modified)192 self.assertNotEqual('No header', response.headers.get('Last-Modified', 'No header'))193 response = Response()194 s3_listener.append_last_modified_headers(response)...

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