15 |
16 |
16 self.assertEqual(stmt._fmt_data(), line) |
17 self.assertEqual(stmt._fmt_data(), line) |
17 |
18 |
18 def test_statement (self) : |
19 def test_statement (self) : |
19 self.assert_stmt(dhcpc.Statement("stmt0"), "stmt0") |
20 self.assert_stmt(dhcpc.Statement("stmt0"), "stmt0") |
20 self.assert_stmt(dhcpc.Statement("stmt3", [ "this", "that" ]), "stmt3 this, that") |
21 self.assert_stmt(dhcpc.Statement("stmt1", [ "this", "that" ]), "stmt1 this, that") |
21 self.assert_stmt(dhcpc.Statement("stmt4", dhcpc.Literal("...")), "stmt4 ...") |
22 self.assert_stmt(dhcpc.Statement("stmt2", dhcpc.Literal("...")), "stmt2 ...") |
22 self.assert_stmt(dhcpc.Statement("stmt1", u"quux"), "stmt1 quux") |
23 self.assert_stmt(dhcpc.Statement("stmt3", u"quux"), "stmt3 quux") |
23 self.assert_stmt(dhcpc.Statement("stmt1", "bar"), "stmt1 bar") |
24 self.assert_stmt(dhcpc.Statement("stmt4", "bar"), "stmt4 bar") |
24 self.assert_stmt(dhcpc.Statement("stmt2", 1), "stmt2 1") |
25 self.assert_stmt(dhcpc.Statement("stmt5", 1), "stmt5 1") |
|
26 self.assert_stmt(dhcpc.Statement("stmt6", 1, None, 2), "stmt6 1 2") |
25 |
27 |
26 def assert_obj (self, obj, lines) : |
28 def assert_obj (self, obj, lines) : |
27 """ |
29 """ |
28 Formats the given conf.Object and compares the output against the given lines |
30 Formats the given conf.Object and compares the output against the given lines |
29 """ |
31 """ |
36 def test_parameter (self) : |
38 def test_parameter (self) : |
37 self.assert_obj(dhcpc.Parameter("param0", "this", 13, "that"), [ "param0 this 13 that;" ]) |
39 self.assert_obj(dhcpc.Parameter("param0", "this", 13, "that"), [ "param0 this 13 that;" ]) |
38 |
40 |
39 def test_declaration (self) : |
41 def test_declaration (self) : |
40 self.assert_obj(dhcpc.Declaration("decl0", ["arg0", "arg1"], [ |
42 self.assert_obj(dhcpc.Declaration("decl0", ["arg0", "arg1"], [ |
41 dhcpc.Parameter("param0") |
43 dhcpc.Parameter("param0"), |
|
44 None |
42 ], [ |
45 ], [ |
43 dhcpc.Declaration("decl0.0", params=[ |
46 dhcpc.Declaration("decl0.0", params=[ |
44 dhcpc.Parameter("param0.0.1", "value") |
47 dhcpc.Parameter("param0.0.1", "value") |
45 ]) |
48 ]) |
46 ]), [ |
49 ]), [ |