Esempio n. 1
0
def write_base_config():
    """If HTTP basic auth is enabled, creates the needed auth config"""
    if util.http_basic_auth_enabled():
        write_json(os.path.abspath('.cs.json'), basic_auth_config())
        cp = config_get('http.auth.basic.user', '--verbose')
        auth_user = stdout(cp)
        logging.debug(f'stderr is:\n{decode(cp.stderr)}')
        logging.info(f'Auth user is "{auth_user}"')
Esempio n. 2
0
def write_base_config():
    """If plugins or HTTP basic auth are enabled, creates the config"""
    config = base_config()
    if config:
        write_json(os.path.abspath('.cs.json'), config)
        if util.http_basic_auth_enabled():
            cp = config_get('http.auth.basic.user', '--verbose')
            auth_user = stdout(cp)
            logging.debug(f'stderr is:\n{decode(cp.stderr)}')
            logging.info(f'Auth user is "{auth_user}"')
Esempio n. 3
0
def base_config():
    """Returns a "base" config map that can be added to."""
    basic_auth = basic_auth_config() if util.http_basic_auth_enabled() else {}
    plugins = plugins_config()
    return deep_merge(basic_auth, plugins)
Esempio n. 4
0
def base_config():
    """Returns a "base" config map that can be added to."""
    config = basic_auth_config() if util.http_basic_auth_enabled() else {}
    return config
Esempio n. 5
0
import os
import pytest
import subprocess
import unittest
import uuid

from urllib.parse import urlparse

from tests.cook import cli, util


@pytest.mark.cli
@unittest.skipUnless(
    util.multi_cluster_tests_enabled(),
    'Requires setting the COOK_MULTI_CLUSTER environment variable')
@unittest.skipIf(util.http_basic_auth_enabled(),
                 'Cook CLI does not currently support HTTP Basic Auth')
@pytest.mark.timeout(util.DEFAULT_TEST_TIMEOUT_SECS)  # individual test timeout
class MultiCookCliTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.cook_url_1 = util.retrieve_cook_url()
        cls.cook_url_2 = util.retrieve_cook_url('COOK_SCHEDULER_URL_2',
                                                'http://localhost:22321')
        util.init_cook_session(cls.cook_url_1, cls.cook_url_2)

    def setUp(self):
        self.cook_url_1 = type(self).cook_url_1
        self.cook_url_2 = type(self).cook_url_2
        self.logger = logging.getLogger(__name__)