How to use search_hypervisor method in tempest

Best Python code snippet using tempest_python

test_hypervisor_negative.py

Source: test_hypervisor_negative.py Github

copy

Full Screen

1# Copyright 2013 Huawei Technologies Co.,LTD.2# All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License"); you may5# not use this file except in compliance with the License. You may obtain6# a copy of the License at7#8# http:/​/​www.apache.org/​licenses/​LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13# License for the specific language governing permissions and limitations14# under the License.15import uuid16from tempest_lib import exceptions as lib_exc17from tempest.api.compute import base18from tempest.common.utils import data_utils19from tempest import test20class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):21 """Tests Hypervisors API that require admin privileges"""22 @classmethod23 def setup_clients(cls):24 super(HypervisorAdminNegativeTestJSON, cls).setup_clients()25 cls.client = cls.os_adm.hypervisor_client26 cls.non_adm_client = cls.hypervisor_client27 def _list_hypervisors(self):28 # List of hypervisors29 hypers = self.client.list_hypervisors()['hypervisors']30 return hypers31 @test.attr(type=['negative'])32 @test.idempotent_id('c136086a-0f67-4b2b-bc61-8482bd68989f')33 def test_show_nonexistent_hypervisor(self):34 nonexistent_hypervisor_id = str(uuid.uuid4())35 self.assertRaises(36 lib_exc.NotFound,37 self.client.show_hypervisor,38 nonexistent_hypervisor_id)39 @test.attr(type=['negative'])40 @test.idempotent_id('51e663d0-6b89-4817-a465-20aca0667d03')41 def test_show_hypervisor_with_non_admin_user(self):42 hypers = self._list_hypervisors()43 self.assertTrue(len(hypers) > 0)44 self.assertRaises(45 lib_exc.Forbidden,46 self.non_adm_client.show_hypervisor,47 hypers[0]['id'])48 @test.attr(type=['negative'])49 @test.idempotent_id('2a0a3938-832e-4859-95bf-1c57c236b924')50 def test_show_servers_with_non_admin_user(self):51 hypers = self._list_hypervisors()52 self.assertTrue(len(hypers) > 0)53 self.assertRaises(54 lib_exc.Forbidden,55 self.non_adm_client.list_servers_on_hypervisor,56 hypers[0]['id'])57 @test.attr(type=['negative'])58 @test.idempotent_id('02463d69-0ace-4d33-a4a8-93d7883a2bba')59 def test_show_servers_with_nonexistent_hypervisor(self):60 nonexistent_hypervisor_id = str(uuid.uuid4())61 self.assertRaises(62 lib_exc.NotFound,63 self.client.list_servers_on_hypervisor,64 nonexistent_hypervisor_id)65 @test.attr(type=['negative'])66 @test.idempotent_id('e2b061bb-13f9-40d8-9d6e-d5bf17595849')67 def test_get_hypervisor_stats_with_non_admin_user(self):68 self.assertRaises(69 lib_exc.Forbidden,70 self.non_adm_client.show_hypervisor_statistics)71 @test.attr(type=['negative'])72 @test.idempotent_id('f60aa680-9a3a-4c7d-90e1-fae3a4891303')73 def test_get_nonexistent_hypervisor_uptime(self):74 nonexistent_hypervisor_id = str(uuid.uuid4())75 self.assertRaises(76 lib_exc.NotFound,77 self.client.show_hypervisor_uptime,78 nonexistent_hypervisor_id)79 @test.attr(type=['negative'])80 @test.idempotent_id('6c3461f9-c04c-4e2a-bebb-71dc9cb47df2')81 def test_get_hypervisor_uptime_with_non_admin_user(self):82 hypers = self._list_hypervisors()83 self.assertTrue(len(hypers) > 0)84 self.assertRaises(85 lib_exc.Forbidden,86 self.non_adm_client.show_hypervisor_uptime,87 hypers[0]['id'])88 @test.attr(type=['negative'])89 @test.idempotent_id('51b3d536-9b14-409c-9bce-c6f7c794994e')90 def test_get_hypervisor_list_with_non_admin_user(self):91 # List of hypervisor and available services with non admin user92 self.assertRaises(93 lib_exc.Forbidden,94 self.non_adm_client.list_hypervisors)95 @test.attr(type=['negative'])96 @test.idempotent_id('dc02db05-e801-4c5f-bc8e-d915290ab345')97 def test_get_hypervisor_list_details_with_non_admin_user(self):98 # List of hypervisor details and available services with non admin user99 self.assertRaises(100 lib_exc.Forbidden,101 self.non_adm_client.list_hypervisors, detail=True)102 @test.attr(type=['negative'])103 @test.idempotent_id('19a45cc1-1000-4055-b6d2-28e8b2ec4faa')104 def test_search_nonexistent_hypervisor(self):105 nonexistent_hypervisor_name = data_utils.rand_name('test_hypervisor')106 self.assertRaises(107 lib_exc.NotFound,108 self.client.search_hypervisor,109 nonexistent_hypervisor_name)110 @test.attr(type=['negative'])111 @test.idempotent_id('5b6a6c79-5dc1-4fa5-9c58-9c8085948e74')112 def test_search_hypervisor_with_non_admin_user(self):113 hypers = self._list_hypervisors()114 self.assertTrue(len(hypers) > 0)115 self.assertRaises(116 lib_exc.Forbidden,117 self.non_adm_client.search_hypervisor,...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Rebuild Confidence in Your Test Automation

These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.

What will come after “agile”?

I think that probably most development teams describe themselves as being “agile” and probably most development teams have standups, and meetings called retrospectives.There is also a lot of discussion about “agile”, much written about “agile”, and there are many presentations about “agile”. A question that is often asked is what comes after “agile”? Many testers work in “agile” teams so this question matters to us.

Test strategy and how to communicate it

I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.

Do you possess the necessary characteristics to adopt an Agile testing mindset?

To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.

How To Refresh Page Using Selenium C# [Complete Tutorial]

When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.

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 tempest 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