#!/usr/bin/python # -*- coding: utf-8 -*- # This file is part of Cockpit. # # Copyright (C) 2015 Red Hat, Inc. # # Cockpit is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Cockpit is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with Cockpit; If not, see . import parent from testlib import * from storagelib import * class TestStorage(StorageCase): def testDosParts(self): m = self.machine b = self.browser self.login_and_go("/storage") # Add a disk m.add_disk("50M", serial="MYDISK") b.wait_in_text("#drives", "MYDISK") b.click('tr:contains("MYDISK")') b.wait_visible("#storage-detail") # Format it with a DOS partition table b.click('button:contains(Create partition table)') self.dialog({ "type": "dos" }) self.content_row_wait_in_col(1, 1, "Free Space") # Create a primary partition self.content_row_action(1, "Create Partition") self.dialog({ "size": 10, "type": "ext4", "name": "FIRST" }) self.content_row_wait_in_col(1, 1, "ext4 File System") self.content_tab_wait_in_info(1, 2, "Name", "FIRST") # Open dialog for formatting the primary partition and check that "dos-extended" is not offered. self.content_tab_action(1, 2, "Format") self.dialog_wait_open() self.assertEqual(b.attr("[value='dos-extended']", "class"), "disabled") self.dialog_cancel() self.dialog_wait_close() # Create a extended partition to fill the rest of the disk self.content_row_action(2, "Create Partition") self.dialog_wait_open() b.wait_not_attr("[value='dos-extended']", "class", "disabled") self.dialog_set_val("type", "dos-extended") self.dialog_wait_not_visible("name") self.dialog_wait_not_visible("mounting") self.dialog_wait_not_visible("mount_point") self.dialog_wait_not_visible("mount_options") self.dialog_apply() self.dialog_wait_close() self.content_row_wait_in_col(2, 1, "Extended Partition") self.content_row_wait_in_col(3, 1, "Free Space") # Create logical partitions and check that "dos-extended" is # not offered. self.content_row_action(3, "Create Partition") self.dialog_wait_open() self.assertEqual(b.attr("[value='dos-extended']", "class"), "disabled") self.dialog_apply() self.dialog_wait_close() self.content_row_wait_in_col(3, 1, "xfs File System") # Delete it self.content_head_action(2, "Delete") self.confirm() self.content_row_wait_in_col(2, 1, "Free Space") if __name__ == '__main__': test_main()