Esempio n. 1
0
 def test_config_and_arguments(self):
     """Test Config.add_command_line_arguments() with config file and arguments."""
     args = parse_args([
         "-c",
         os.path.join(EXAMPLE_CONFIG_DIR, "Debian-unstable.yaml"),
         "--name",
         "Debian-unstable",
         "--variant",
         "standard",
         "--mode",
         "root",
         "--aptopt",
         'Apt::Install-Recommends "0"',
         "--keyring",
         "/usr/share/keyrings",
         "--dpkgopt",
         "force-confdef",
         "--dpkgopt",
         "force-confold",
         "--include",
         "ionit,netconsole",
         "--components",
         "main,non-free",
         "--architectures",
         "i386",
         "--mirrors",
         "http://deb.debian.org/debian",
         "unstable",
         "unstable.tar",
     ])
     config = Config()
     config.add_command_line_arguments(args)
     self.assertDictEqual(
         config,
         {
             "mmdebstrap": {
                 "aptopts": ['Apt::Install-Recommends "0"'],
                 "architectures": ["i386"],
                 "components": ["main", "non-free"],
                 "dpkgopts": ["force-confdef", "force-confold"],
                 "keyrings": [
                     "/usr/share/keyrings/debian-archive-keyring.gpg",
                     "/usr/share/keyrings",
                 ],
                 "mirrors": ["http://deb.debian.org/debian"],
                 "mode":
                 "root",
                 "packages": ["ionit", "netconsole"],
                 "suite":
                 "unstable",
                 "target":
                 "unstable.tar",
                 "variant":
                 "standard",
             },
             "name": "Debian-unstable",
         },
     )
Esempio n. 2
0
 def test_add_command_line_arguments(self):
     """Test Config.add_command_line_arguments()."""
     args = parse_args([
         "-c",
         os.path.join(EXAMPLE_CONFIG_DIR, "Debian-unstable.yaml"),
         "--name",
         "Debian-unstable",
     ])
     config = Config()
     config.add_command_line_arguments(args)
     self.assertEqual(
         config,
         {
             "mmdebstrap": {
                 "keyrings":
                 ["/usr/share/keyrings/debian-archive-keyring.gpg"],
                 "mode": "unshare",
                 "suite": "unstable",
                 "target": "root.tar.xz",
                 "variant": "minbase",
             },
             "name": "Debian-unstable",
         },
     )