Skip to content

Commit

Permalink
Merge pull request #178 from SalesforceFoundation/feature/run-apex-tests
Browse files Browse the repository at this point in the history
Run apex tests
  • Loading branch information
jlantz authored Nov 1, 2016
2 parents e0a3bed + bafe6ba commit 72589a7
Show file tree
Hide file tree
Showing 7 changed files with 757 additions and 74 deletions.
1 change: 1 addition & 0 deletions build/admin_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<members>*</members>
<members>Account</members>
<members>Campaign</members>
<members>CampaignMember</members>
<members>Contact</members>
<members>Lead</members>
<members>Opportunity</members>
Expand Down
40 changes: 22 additions & 18 deletions cumulusci/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BaseConfig(object):

def __init__(self, config=None):
if config is None:
self.config = {}
self.config = {}
else:
self.config = config
self._load_config()
Expand All @@ -46,7 +46,7 @@ def __getattr__(self, name):
break
if config is None:
continue

if tree[-1] in config:
value = config[tree[-1]]
value_found = True
Expand Down Expand Up @@ -175,7 +175,7 @@ def repo_commit(self):
join_args = [self.repo_root, '.git', 'refs', 'heads']
join_args.extend(branch.split('/'))
commit_file = os.path.join(*join_args)

f = open(commit_file, 'r')
commit_sha = f.read().strip()
f.close()
Expand Down Expand Up @@ -220,8 +220,8 @@ def list_orgs(self):
""" Returns a list of all org names for the project """
self._check_keychain()
return self.keychain.list_orgs()
def get_org(self, name):

def get_org(self, name):
""" Returns an OrgConfig for the given org_name """
self._check_keychain()
return self.keychain.get_org(name)
Expand All @@ -230,12 +230,12 @@ def set_org(self, name, org_config):
""" Creates or updates an org's oauth info """
self._check_keychain()
return self.keychain.set_org(name, org_config)


class BaseGlobalConfig(BaseTaskFlowConfig):
""" Base class for the global config which contains all configuration not specific to projects """
project_config_class = BaseProjectConfig

config_local_dir = '.cumulusci'

def list_projects(self):
Expand All @@ -259,8 +259,8 @@ class OrgConfig(BaseConfig):

def refresh_oauth_token(self, connected_app):
sf_oauth = SalesforceOAuth2(
connected_app.client_id,
connected_app.client_secret,
connected_app.client_id,
connected_app.client_secret,
connected_app.callback_url,
False
)
Expand All @@ -273,6 +273,10 @@ def start_url(self):
start_url = '%s/secur/frontdoor.jsp?sid=%s' % (self.instance_url, self.access_token)
return start_url

@property
def user_id(self):
return self.id.split('/')[-1]

class GithubConfig(BaseConfig):
""" Github configuration """
pass
Expand Down Expand Up @@ -312,7 +316,7 @@ def _load_config(self):
# Initialize the dictionaries for the individual configs
self.config_project = {}
self.config_project_local = {}

# Verify that we're in a project
repo_root = self.repo_root
if not repo_root:
Expand All @@ -327,7 +331,7 @@ def _load_config(self):
)
)

# Start the merged yaml config from the global and global local configs
# Start the merged yaml config from the global and global local configs
merge_yaml = [self.global_config_obj.config_global_path]
if self.global_config_obj.config_global_local_path:
merge_yaml.append(self.global_config_obj.config_global_local_path)
Expand All @@ -349,7 +353,7 @@ def _load_config(self):

self.config = hiyapyco.load(*merge_yaml, method=hiyapyco.METHOD_MERGE)


class YamlGlobalConfig(BaseGlobalConfig):
config_filename = 'cumulusci.yml'
config_local_dir = '.cumulusci'
Expand All @@ -368,16 +372,16 @@ def config_global_local_path(self):
)
if not os.path.exists(directory):
os.makedirs(directory)

config_path = os.path.join(
directory,
self.config_filename,
)
)
if not os.path.isfile(config_path):
return None

return config_path

def _load_config(self):
""" Loads the local configuration """
# load the global config
Expand All @@ -393,14 +397,14 @@ def _load_config(self):
merge_yaml.append(self.config_global_local_path)

self.config = hiyapyco.load(*merge_yaml, method=hiyapyco.METHOD_MERGE)

@property
def config_global_path(self):
return os.path.join( __location__, '..', self.config_filename)

def _load_global_config(self):
""" Loads the configuration for the project """

# Load the global cumulusci.yml file
f_config = open(self.config_global_path, 'r')
config = yaml.load(f_config)
Expand Down
21 changes: 21 additions & 0 deletions cumulusci/tasks/metadata/metadata_map_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ components:
connectedApps:
- type: ConnectedApp
class: MetadataFilenameParser
contentassets:
- type: ContentAsset
class: MetadataFilenameParser
extension: asset
customMetadata:
- type: CustomMetadata
class: MetadataFilenameParser
Expand All @@ -31,6 +35,18 @@ documents:
email:
- type: EmailTemplate
class: MetadataFolderParser
flexipages:
- type: FlexiPage
class: MetadataFilenameParser
extension: flexipage
globalPicklist:
- type: GlobalPicklist
class: MetadataFilenameParser
extension: globalPicklist
globalValueSets:
- type: GlobalValueSet
class: MetadataFilenameParser
extension: globalValueSet
homePageComponents:
- type: HomePageComponent
class: MetadataFilenameParser
Expand Down Expand Up @@ -179,3 +195,8 @@ workflows:
extension: workflow
options:
item_xpath: './sf:rules'
- type: WorkflowTask
class: MetadataXmlElementParser
extension: workflow
options:
item_xpath: './sf:tasks'
Loading

0 comments on commit 72589a7

Please sign in to comment.