Exemplo n.º 1
0
 def test__prepare_cmd_flags(self):
     self.assertEqual(
         helm._prepare_cmd(flags=["flag1", "--flag2"]),
         (
             "helm",
             "--flag1",
             "--flag2",
         ),
     )
Exemplo n.º 2
0
 def test__prepare_cmd_commands(self):
     self.assertEqual(
         helm._prepare_cmd(commands=["com1", "com2"]),
         (
             "helm",
             "com1",
             "com2",
         ),
     )
Exemplo n.º 3
0
 def test__exec_cmd(self):
     cmd_prepare = helm._prepare_cmd()
     cmd_prepare_str = " ".join(cmd_prepare)
     cmd_return = {
         "stdout": "succes",
         "stderr": "",
         "retcode": 0,
     }
     result = cmd_return
     result.update({"cmd": cmd_prepare_str})
     with patch.dict(
             helm.__salt__,
         {  # pylint: disable=no-member
             "cmd.run_all": MagicMock(return_value=cmd_return)
         },
     ):
         self.assertEqual(helm._exec_cmd(), result)
Exemplo n.º 4
0
    def test__prepare_cmd_kvflags(self):
        result_tuple = helm._prepare_cmd(kvflags={
            "kflag1": "vflag1",
            "--kflag2": "vflag2"
        })
        tuple_valide_1 = (
            "helm",
            "--kflag1",
            "vflag1",
            "--kflag2",
            "vflag2",
        )
        tuple_valide_2 = (
            "helm",
            "--kflag2",
            "vflag2",
            "--kflag1",
            "vflag1",
        )

        #
        self.assertEqual(
            True, result_tuple == tuple_valide_1
            or result_tuple == tuple_valide_2)
Exemplo n.º 5
0
 def test__prepare_cmd_binary(self):
     self.assertEqual(helm._prepare_cmd(binary="binary"), ("binary", ))
Exemplo n.º 6
0
 def test__prepare_cmd(self):
     self.assertEqual(helm._prepare_cmd(), ("helm", ))