Best Python code snippet using tempest_python
test_container_acl_negative.py
Source:test_container_acl_negative.py  
...126        self.assertRaises(exceptions.Unauthorized,127                          self.custom_object_client.get_object,128                          self.container_name, object_name)129    @test.attr(type=['negative', 'smoke'])130    def test_write_object_without_rights(self):131        # attempt to write object using non-authorized user132        # update X-Container-Write metadata ACL133        cont_headers = {'X-Container-Write': 'badtenant:baduser'}134        resp_meta, body = self.container_client.update_container_metadata(135            self.container_name, metadata=cont_headers,136            metadata_prefix='')137        self.assertHeaders(resp_meta, 'Container', 'POST')138        # Trying to write the object without rights139        self.custom_object_client.auth_provider.set_alt_auth_data(140            request_part='headers',141            auth_data=self.test_auth_data142        )143        object_name = data_utils.rand_name(name='Object')144        self.assertRaises(exceptions.Unauthorized,...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!!
