How to use _list_snapshots_param_sort method in tempest

Best Python code snippet using tempest_python

test_volumes_snapshots_list.py

Source: test_volumes_snapshots_list.py Github

copy

Full Screen

...31 # Create 3 snapshots32 for _ in range(3):33 snapshot = cls.create_snapshot(cls.volume_origin['id'])34 cls.snapshot_id_list.append(snapshot['id'])35 def _list_snapshots_param_sort(self, sort_key, sort_dir):36 """list snapshots by sort param"""37 snap_list = self.snapshots_client.list_snapshots(38 sort_key=sort_key, sort_dir=sort_dir)['snapshots']39 self.assertNotEmpty(snap_list)40 if sort_key is 'display_name':41 sort_key = 'name'42 # Note: On Cinder V2 API, 'display_name' works as a sort key43 # on a request, a volume name appears as 'name' on the response.44 # So Tempest needs to change the key name here for this inconsistent45 # API behavior.46 sorted_list = [snapshot[sort_key] for snapshot in snap_list]47 msg = 'The list of snapshots was not sorted correctly.'48 self.assertEqual(sorted(sorted_list, reverse=(sort_dir == 'desc')),49 sorted_list, msg)50 @decorators.idempotent_id('c5513ada-64c1-4d28-83b9-af3307ec1388')51 def test_snapshot_list_param_sort_id_asc(self):52 self._list_snapshots_param_sort(sort_key='id', sort_dir='asc')53 @decorators.idempotent_id('8a7fe058-0b41-402a-8afd-2dbc5a4a718b')54 def test_snapshot_list_param_sort_id_desc(self):55 self._list_snapshots_param_sort(sort_key='id', sort_dir='desc')56 @decorators.idempotent_id('4052c3a0-2415-440a-a8cc-305a875331b0')57 def test_snapshot_list_param_sort_created_at_asc(self):58 self._list_snapshots_param_sort(sort_key='created_at', sort_dir='asc')59 @decorators.idempotent_id('dcbbe24a-f3c0-4ec8-9274-55d48db8d1cf')60 def test_snapshot_list_param_sort_created_at_desc(self):61 self._list_snapshots_param_sort(sort_key='created_at', sort_dir='desc')62 @decorators.idempotent_id('d58b5fed-0c37-42d3-8c5d-39014ac13c00')63 def test_snapshot_list_param_sort_name_asc(self):64 self._list_snapshots_param_sort(sort_key='display_name',65 sort_dir='asc')66 @decorators.idempotent_id('96ba6f4d-1f18-47e1-b4bc-76edc6c21250')67 def test_snapshot_list_param_sort_name_desc(self):68 self._list_snapshots_param_sort(sort_key='display_name',69 sort_dir='desc')70 @decorators.idempotent_id('05489dde-44bc-4961-a1f5-3ce7ee7824f7')71 def test_snapshot_list_param_marker(self):72 # The list of snapshots should end before the provided marker73 params = {'marker': self.snapshot_id_list[1]}74 snap_list = self.snapshots_client.list_snapshots(**params)['snapshots']75 fetched_list_id = [snap['id'] for snap in snap_list]76 # Verify the list of snapshots ends before the provided77 # marker(second snapshot), therefore only the first snapshot78 # should displayed....

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

How To Automate Mouse Clicks With Selenium Python

Sometimes, in our test code, we need to handle actions that apparently could not be done automatically. For example, some mouse actions such as context click, double click, drag and drop, mouse movements, and some special key down and key up actions. These specific actions could be crucial depending on the project context.

Scala Testing: A Comprehensive Guide

Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.

Running Tests In Cypress With GitHub Actions [Complete Guide]

In today’s tech world, where speed is the key to modern software development, we should aim to get quick feedback on the impact of any change, and that is where CI/CD comes in place.

Getting Started with SpecFlow Actions [SpecFlow Automation Tutorial]

With the rise of Agile, teams have been trying to minimize the gap between the stakeholders and the development team.

Why Agile Is Great for Your Business

Agile project management is a great alternative to traditional methods, to address the customer’s needs and the delivery of business value from the beginning of the project. This blog describes the main benefits of Agile for both the customer and the business.

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