1 from tests
.baseclass
import *
3 class FC3_TestCase(CommandTest
):
8 self
.assert_parse("clearpart")
9 self
.assert_parse("clearpart --all", "clearpart --all\n")
10 self
.assert_parse("clearpart --none", "clearpart --none\n")
11 # Passing multiple competing type options should accept only the last one
12 self
.assert_parse("clearpart --linux --none --all", "clearpart --all\n")
13 # Setting --initlabel or --drives without a type option should 'fail'
14 self
.assert_parse("clearpart --initlabel", "")
15 self
.assert_parse("clearpart --drives sda", "")
17 self
.assert_parse("clearpart --all --initlabel", "clearpart --all --initlabel\n")
18 self
.assert_parse("clearpart --all --drives sda", "clearpart --all --drives=sda\n")
19 self
.assert_parse("clearpart --all --drives sda,sdb", "clearpart --all --drives=sda,sdb\n")
20 self
.assert_parse("clearpart --all --drives=sda", "clearpart --all --drives=sda\n")
21 self
.assert_parse("clearpart --all --drives=sda,sdb", "clearpart --all --drives=sda,sdb\n")
23 self
.assert_parse("clearpart --drives=sda,sdb --all --linux --initlabel", "clearpart --linux --initlabel --drives=sda,sdb\n")
26 # initlabel should not take a value
27 self
.assert_parse_error("clearpart --initlabel=foo")
28 # drives must take a value
29 self
.assert_parse_error("clearpart --all --drives")
30 # nonsensical parameter test
31 self
.assert_parse_error("clearpart --cheese")
33 class F17_TestCase(FC3_TestCase
):
35 FC3_TestCase
.runTest(self
)
36 self
.assert_parse("clearpart --list=sda2,sda3,disk/by-label/foo",
37 "clearpart --list=sda2,sda3,disk/by-label/foo\n")
39 class F21_TestCase(F17_TestCase
):
41 F17_TestCase
.runTest(self
)
42 self
.assert_parse("clearpart --all --initlabel --disklabel=gpt",
43 "clearpart --all --initlabel --disklabel=gpt\n")
44 self
.assert_parse_error("clearpart --all --disklabel")
46 if __name__
== "__main__":