Best Python code snippet using tempest_python
test_aggregates_negative.py
Source:test_aggregates_negative.py  
...104        self.assertRaises(lib_exc.NotFound,105                          self.client.show_aggregate, -1)106    @decorators.attr(type=['negative'])107    @decorators.idempotent_id('0ef07828-12b4-45ba-87cc-41425faf5711')108    def test_aggregate_add_non_exist_host(self):109        # Adding a non-exist host to an aggregate should raise exceptions.110        while True:111            non_exist_host = data_utils.rand_name('nonexist_host')112            if non_exist_host not in self.hosts:113                break114        aggregate = self._create_test_aggregate()115        self.assertRaises(lib_exc.NotFound, self.client.add_host,116                          aggregate['id'], host=non_exist_host)117    @decorators.attr(type=['negative'])118    @decorators.idempotent_id('7324c334-bd13-4c93-8521-5877322c3d51')119    def test_aggregate_add_host_as_user(self):120        # Regular user is not allowed to add a host to an aggregate.121        aggregate = self._create_test_aggregate()122        self.assertRaises(lib_exc.Forbidden,...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!!
