コード例 #1
0
ファイル: test_mpi_commands.py プロジェクト: jkntnx/calm-dsl
    def test_get_marketplace_bps(self):
        """Tests 'calm get marketplace_bps command'"""

        runner = CliRunner()

        LOG.info("Running 'calm get marketplace_bps' command")
        result = runner.invoke(cli, ["get", "marketplace_bps"])
        if result.exit_code:
            LOG.error(result.output)
            pytest.fail("MPI list call failed")
        LOG.info("Success")

        # Test quiet flag
        LOG.info("Running 'calm get marketplace_bps --quiet' command")
        result = runner.invoke(cli, ["get", "marketplace_bps", "--quiet"])
        if result.exit_code:
            LOG.error(result.output)
            pytest.fail("MPI list call with quiet flag failed")
        LOG.info("Success")

        # Test app states option
        LOG.info(
            "Testing app_state option for  'calm get marketplace_bps' command")
        app_states = APP_STATES
        app_states = sum(
            [
                list(map(list, combinations(app_states, i)))
                for i in range(len(app_states) + 1)
            ],
            [],
        )
        for app_state_list in app_states:
            input = ["get", "marketplace_bps"]
            for app_state in app_state_list:
                input.append("--app_state")
                input.append(app_state)
            result = runner.invoke(cli, input)
            if result.exit_code:
                LOG.error(result.ouput)
                pytest.fail("MPI list call with app_state option failed")
        LOG.info("Success")

        # Test app_family attribute
        LOG.info(
            "Testing app_family option for  'calm get marketplace_items' command"
        )
        app_family_list = get_app_family_list()
        input = ["get", "marketplace_items", "--app_family", ""]
        for app_family in app_family_list:
            input[3] = app_family
            result = runner.invoke(cli, input)
            if result.exit_code:
                LOG.error(result.output)
                pytest.fail("MPI list call with app_family option failed")
        LOG.info("Success")
コード例 #2
0
ファイル: test_mpi_commands.py プロジェクト: jkntnx/calm-dsl
    def test_get_marketplace_items(self):
        """Tests 'calm get marketplace_items command'"""

        runner = CliRunner()
        LOG.info("Running 'calm get marketplace_items' command")
        result = runner.invoke(cli, ["get", "marketplace_items"])
        if result.exit_code:
            LOG.error(result.output)
            pytest.fail("MPI list call failed")
        LOG.info("Success")

        # Test display all flag
        LOG.info("Running 'calm get marketplace_items --display_all' command")
        result = runner.invoke(cli,
                               ["get", "marketplace_items", "--display_all"])
        if result.exit_code:
            LOG.error(result.output)
            pytest.fail("MPI list call with display_all flag failed")
        LOG.info("Success")

        # Test quiet flag
        LOG.info("Running 'calm get marketplace_items --quiet' command")
        result = runner.invoke(cli, ["get", "marketplace_items", "--quiet"])
        if result.exit_code:
            LOG.error(result.output)
            pytest.fail("MPI list call with quiet flag failed")
        LOG.info("Success")

        # Test app_family attribute
        LOG.info(
            "Testing app_family option for  'calm get marketplace_items' command"
        )
        app_family_list = get_app_family_list()
        input = ["get", "marketplace_items", "--app_family", ""]
        for app_family in app_family_list:
            input[3] = app_family
            result = runner.invoke(cli, input)
            if result.exit_code:
                LOG.error(result.output)
                pytest.fail("MPI list call with app_family option failed")
        LOG.info("Success")