'This test checks volumes pagination
Steps:
1) Login to Horizon Dashboard
2) Go to Project -> Compute -> Volumes -> Volumes tab and create
three volumes
3) Navigate to user settings page
4) Change \'Items Per Page\' value to 1
5) Go to Project -> Compute -> Volumes -> Volumes tab or
Admin -> System -> Volumes -> Volumes tab (depends on user)
6) Check that only \'Next\' link is available, only one volume is
available (and it has correct name)
7) Click \'Next\' and check that both \'Prev\' and \'Next\' links are
available, only one volume is available (and it has correct name)
8) Click \'Next\' and check that only \'Prev\' link is available,
only one volume is visible (and it has correct name)
9) Click \'Prev\' and check result (should be the same as for step7)
10) Click \'Prev\' and check result (should be the same as for step6)
11) Go to user settings page and restore \'Items Per Page\'
12) Delete created volumes'

def test_volumes_pagination(self):

    volumes_page = self.home_pg.go_to_compute_volumes_volumespage()
    count = 3
    items_per_page = 1
    volumes_names = ['{0}_{1}'.format(self.VOLUME_NAME, i) for i in range(count)]
    for volume_name in volumes_names:
        volumes_page.create_volume(volume_name)
        volumes_page.find_message_and_dismiss(messages.INFO)
        self.assertTrue(volumes_page.is_volume_present(volume_name))
    first_page_definition = {'Next': True, 'Prev': False, 'Count': items_per_page, 'Names': [volumes_names[2]]}
    second_page_definition = {'Next': True, 'Prev': True, 'Count': items_per_page, 'Names': [volumes_names[1]]}
    third_page_definition = {'Next': False, 'Prev': True, 'Count': items_per_page, 'Names': [volumes_names[0]]}
    settings_page = self.home_pg.go_to_settings_usersettingspage()
    settings_page.change_pagesize(items_per_page)
    settings_page.find_message_and_dismiss(messages.SUCCESS)
    volumes_page = self.volumes_page
    volumes_page.volumes_table.assert_definition(first_page_definition)
    volumes_page.volumes_table.turn_next_page()
    volumes_page.volumes_table.assert_definition(second_page_definition)
    volumes_page.volumes_table.turn_next_page()
    volumes_page.volumes_table.assert_definition(third_page_definition)
    volumes_page.volumes_table.turn_prev_page()
    volumes_page.volumes_table.assert_definition(second_page_definition)
    volumes_page.volumes_table.turn_prev_page()
    volumes_page.volumes_table.assert_definition(first_page_definition)
    settings_page = self.home_pg.go_to_settings_usersettingspage()
    settings_page.change_pagesize()
    settings_page.find_message_and_dismiss(messages.SUCCESS)
    volumes_page = self.volumes_page
    volumes_page.delete_volumes(volumes_names)
    volumes_page.find_message_and_dismiss(messages.SUCCESS)
    self.assertTrue(volumes_page.are_volumes_deleted(volumes_names))
