'This test checks images pagination
Steps:
1) Login to Horizon Dashboard as horizon user
2) Navigate to user settings page
3) Change \'Items Per Page\' value to 1
4) Go to Project -> Compute -> Images page
5) Check that only \'Next\' link is available, only one image is
available (and it has correct name)
6) Click \'Next\' and check that both \'Prev\' and \'Next\' links are
available, only one image is available (and it has correct name)
7) Click \'Next\' and check that only \'Prev\' link is available,
only one image is visible (and it has correct name)
8) Click \'Prev\' and check results (should be the same as for step6)
9) Click \'Prev\' and check results (should be the same as for step5)
10) Go to user settings page and restore \'Items Per Page\''

def test_images_pagination(self):

    default_image_list = self.CONFIG.image.images_list
    items_per_page = 1
    first_page_definition = {'Next': True, 'Prev': False, 'Count': items_per_page, 'Names': [default_image_list[0]]}
    second_page_definition = {'Next': True, 'Prev': True, 'Count': items_per_page, 'Names': [default_image_list[1]]}
    third_page_definition = {'Next': False, 'Prev': True, 'Count': items_per_page, 'Names': [default_image_list[2]]}
    settings_page = self.home_pg.go_to_settings_usersettingspage()
    settings_page.change_pagesize(items_per_page)
    settings_page.find_message_and_dismiss(messages.SUCCESS)
    images_page = self.images_page
    images_page.images_table.assert_definition(first_page_definition)
    images_page.images_table.turn_next_page()
    images_page.images_table.assert_definition(second_page_definition)
    images_page.images_table.turn_next_page()
    images_page.images_table.assert_definition(third_page_definition)
    images_page.images_table.turn_prev_page()
    images_page.images_table.assert_definition(second_page_definition)
    images_page.images_table.turn_prev_page()
    images_page.images_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)
