Exemple #1
0
def org_config_connected_app(config, client_id, client_secret, callback_url, project):
    check_keychain(config)
    app_config = ConnectedAppOAuthConfig()
    app_config.config = {
        'client_id': client_id,
        'client_secret': client_secret,
        'callback_url': callback_url,
    }
    config.keychain.set_connected_app(app_config, project)
Exemple #2
0
def org_config_connected_app(config, client_id, client_secret, callback_url, project):
    check_keychain(config)
    app_config = ConnectedAppOAuthConfig()
    app_config.config = {
        'client_id': client_id,
        'client_secret': client_secret,
        'callback_url': callback_url,
    }
    config.keychain.set_connected_app(app_config, project)
Exemple #3
0
 def _load_app(self):
     try:
         app = os.environ.get(self.app_var.encode('ascii'))
     except TypeError:
         app = os.environ.get(self.app_var)
     if app:
         self.app = ConnectedAppOAuthConfig(json.loads(app))
Exemple #4
0
def get_connected_app():
    return ConnectedAppOAuthConfig({
        "callback_url":
        settings.CONNECTED_APP_CALLBACK_URL,
        "client_id":
        settings.CONNECTED_APP_CLIENT_ID,
        "client_secret":
        settings.CONNECTED_APP_CLIENT_SECRET,
    })
Exemple #5
0
 def get_connected_app(self):
     return ConnectedAppOAuthConfig({
         'callback_url':
         settings.CONNECTED_APP_CALLBACK_URL,
         'client_id':
         settings.CONNECTED_APP_CLIENT_ID,
         'client_secret':
         settings.CONNECTED_APP_CLIENT_SECRET,
     })
 def setUp(self):
     self.global_config = BaseGlobalConfig()
     self.project_config = BaseProjectConfig(self.global_config)
     self.connected_app_config = ConnectedAppOAuthConfig({'test': 'value'})
     self.services = {
         'github': ServiceConfig({'git': 'hub'}),
         'mrbelvedere': ServiceConfig({'mr': 'belvedere'}),
         'apextestsdb': ServiceConfig({'apex': 'testsdb'}),
     }
     self.org_config = OrgConfig({'foo': 'bar'})
     self.key = '0123456789123456'
Exemple #7
0
    def setUp(self):
        self.global_config = BaseGlobalConfig()
        self.project_config = BaseProjectConfig(self.global_config)
        self.task_config = TaskConfig()

        keychain = BaseProjectKeychain(self.project_config, '')
        app_config = ConnectedAppOAuthConfig()
        keychain.set_connected_app(app_config)
        self.project_config.set_keychain(keychain)

        self._task_log_handler.reset()
        self.task_log = self._task_log_handler.messages
Exemple #8
0
 def setUp(self):
     self.global_config = BaseGlobalConfig()
     self.project_config = BaseProjectConfig(self.global_config)
     self.project_config.config['services'] = {
         'github':{'attributes':{'name':{'required':True}, 'password':{}}},
         'mrbelvedere':{'attributes':{'mr':{'required':True}}},
         'apextestsdb':{'attributes':{'apex':{'required':True}}},
     }
     self.project_config.project__name = 'TestProject'
     self.connected_app_config = ConnectedAppOAuthConfig({'test': 'value'})
     self.services = {
         'github': ServiceConfig({'name': 'hub'}),
         'mrbelvedere': ServiceConfig({'mr': 'belvedere'}),
         'apextestsdb': ServiceConfig({'apex': 'testsdb'}),
     }
     self.org_config = OrgConfig({'foo': 'bar'})
     self.key = '0123456789123456'
 def setUp(self):
     self.api_version = 38.0
     self.global_config = BaseGlobalConfig(
         {'project': {'api_version': self.api_version}})
     self.task_config = TaskConfig()
     self.task_config.config['options'] = {
         'junit_output': 'results_junit.xml',
         'poll_interval': 1,
         'test_name_match': '%_TEST',
     }
     self.project_config = BaseProjectConfig(self.global_config)
     self.project_config.config['project'] = {'package': {
         'api_version': self.api_version}}
     keychain = BaseProjectKeychain(self.project_config, '')
     app_config = ConnectedAppOAuthConfig()
     keychain.set_connected_app(app_config)
     self.project_config.set_keychain(keychain)
     self.org_config = OrgConfig({
         'id': 'foo/1',
         'instance_url': 'example.com',
         'access_token': 'abc123',
     })
     self.base_tooling_url = 'https://{}/services/data/v{}/tooling/'.format(
         self.org_config.instance_url, self.api_version)
import sarge

from cumulusci.core.config import BaseConfig
from cumulusci.core.config import ConnectedAppOAuthConfig
from cumulusci.core.config import ScratchOrgConfig
from cumulusci.core.config import ServiceConfig
from cumulusci.core.exceptions import OrgNotFound
from cumulusci.core.exceptions import ServiceNotConfigured
from cumulusci.core.exceptions import ServiceNotValid
from cumulusci.core.sfdx import sfdx

DEFAULT_CONNECTED_APP = ConnectedAppOAuthConfig({
    "client_id":
    "3MVG9i1HRpGLXp.or6OVlWVWyn8DXi9xueKNM4npq_AWh.yqswojK9sE5WY7f.biP0w7bNJIENfXc7JMDZGO1",
    "client_secret":
    None,
    "callback_url":
    "http://localhost:8080/callback",
})


class BaseProjectKeychain(BaseConfig):
    encrypted = False

    def __init__(self, project_config, key):
        super(BaseProjectKeychain, self).__init__()
        self.config = {"orgs": {}, "app": None, "services": {}}
        self.project_config = project_config
        self.key = key
        self._validate_key()
        self._load_keychain()
Exemple #11
0
 def _load_keychain_app(self):
     app = os.environ.get(self.app_var)
     if app:
         self.app = ConnectedAppOAuthConfig(json.loads(app))