Best Python code snippet using tempest_python
test_security_groups.py
Source:test_security_groups.py  
...129        response = self._do_post('servers/%s/action' % uuid,130                                 'security-group-remove-post-req', subs)131        self.assertEqual(202, response.status_code)132        self.assertEqual('', response.text)133    def test_security_group_rules_create(self):134        response = self._do_post('os-security-group-rules',135                                 'security-group-rules-post-req', {})136        self._verify_response('security-group-rules-post-resp', {}, response,137                              200)138    def test_security_group_rules_remove(self):139        response = self._do_delete(140            'os-security-group-rules/00000000-0000-0000-0000-000000000000')...test_security_group_rules.py
Source:test_security_group_rules.py  
...29        self.from_port = 2230        self.to_port = 2231    @test.attr(type='smoke')32    @test.services('network')33    def test_security_group_rules_create(self):34        # Positive test: Creation of Security Group rule35        # should be successful36        # Creating a Security Group to add rules to it37        resp, security_group = self.create_security_group()38        securitygroup_id = security_group['id']39        # Adding rules to the created Security Group40        resp, rule = \41            self.client.create_security_group_rule(securitygroup_id,42                                                   self.ip_protocol,43                                                   self.from_port,44                                                   self.to_port)45        self.addCleanup(self.client.delete_security_group_rule, rule['id'])46        self.assertEqual(200, resp.status)47    @test.attr(type='smoke')...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!!
