Exemple #1
0
    def test_api_info_minimal(self):
        filename, callfile = write_script(self.dirname,
                                          output=self.API_INFO_YAML)
        self.cli = CLI.from_version(filename, self.VERSION, self.dirname)
        infos = self.cli.api_info()

        self.assertEquals(
            infos, {
                None:
                APIInfo(
                    ["10.235.227.251:17070"],
                    "admin",
                    "0f154812dd1c02973623c887b2565ea3",
                ),
                "controller":
                APIInfo(
                    ["10.235.227.251:17070"],
                    "admin",
                    "0f154812dd1c02973623c887b2565ea3",
                    "d3a5befc-c392-4722-85fc-631531e74a09",
                ),
                "default":
                APIInfo(
                    ["10.235.227.251:17070"],
                    "admin",
                    "0f154812dd1c02973623c887b2565ea3",
                    "b93f17f2-ad56-456d-8051-06e9f7ba46ec",
                ),
            })
        self.assert_called("show-controller --show-password --format=yaml",
                           callfile)
Exemple #2
0
    def test_api_info_minimal(self):
        filename, callfile = write_script(self.dirname,
                                          output=self.API_INFO_JSON)
        self.cli = CLI.from_version(filename, self.VERSION, self.dirname)
        infos = self.cli.api_info()

        self.assertEquals(
            infos, {
                None:
                APIInfo(
                    ["10.235.227.251:17070"],
                    "admin",
                    "0f154812dd1c02973623c887b2565ea3",
                ),
                "controller":
                APIInfo(
                    ["10.235.227.251:17070"],
                    "admin",
                    "0f154812dd1c02973623c887b2565ea3",
                    "d3a5befc-c392-4722-85fc-631531e74a09",
                ),
            })
        self.assert_called("api-info --password --refresh --format=json",
                           callfile)
Exemple #3
0
 def setUp(self):
     super(CLIJuju2Tests, self).setUp()
     self.dirname = tempfile.mkdtemp(prefix="txjuju-test-")
     filename, self.callfile = write_script(self.dirname)
     self.cli = CLI.from_version(filename, self.VERSION, self.dirname)
Exemple #4
0
 def test_from_version_unsupported_version(self):
     with self.assertRaises(ValueError):
         CLI.from_version("juju", "1.25.6", None)
     with self.assertRaises(ValueError):
         CLI.from_version("juju", "1.25.6", "")
Exemple #5
0
 def test_from_version_missing_version(self):
     with self.assertRaises(ValueError):
         CLI.from_version("juju", None, "/tmp")
     with self.assertRaises(ValueError):
         CLI.from_version("juju", "", "/tmp")
Exemple #6
0
 def test_from_version_missing_filename(self):
     with self.assertRaises(ValueError):
         CLI.from_version(None, "1.25.6", "/tmp")
     with self.assertRaises(ValueError):
         CLI.from_version("", "1.25.6", "/tmp")
Exemple #7
0
    def test_from_version_executable_not_found(self):
        filename = self._resolve_executable("does-not-exist")

        with self.assertRaises(_utils.ExecutableNotFoundError):
            CLI.from_version(filename, "1.25.6", "/tmp")