Best Python code snippet using tempest_python
test_aggregates_negative.py
Source:test_aggregates_negative.py  
...133        self.assertRaises(lib_exc.Conflict, self.client.add_host,134                          aggregate['id'], host=self.hosts[0])135    @decorators.attr(type=['negative'])136    @decorators.idempotent_id('7a53af20-137a-4e44-a4ae-e19260e626d9')137    def test_aggregate_remove_host_as_user(self):138        # Regular user is not allowed to remove a host from an aggregate.139        self.useFixture(fixtures.LockFixture('availability_zone'))140        aggregate = self._create_test_aggregate()141        self.client.add_host(aggregate['id'], host=self.hosts[0])142        self.addCleanup(self.client.remove_host, aggregate['id'],143                        host=self.hosts[0])144        self.assertRaises(lib_exc.Forbidden,145                          self.aggregates_client.remove_host,146                          aggregate['id'], host=self.hosts[0])147    @decorators.attr(type=['negative'])148    @decorators.idempotent_id('95d6a6fa-8da9-4426-84d0-eec0329f2e4d')149    def test_aggregate_remove_nonexistent_host(self):150        aggregate = self._create_test_aggregate()151        self.assertRaises(lib_exc.NotFound, self.client.remove_host,...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!!
