class TestClientOperations(unittest.TestCase): # FYI: overriding this constructor is apparently not recommended, so we should find a better way to init test data def __init__(self, *args, **kwargs): super(TestClientOperations, self).__init__(*args, **kwargs) self.username = test_helper.get_creds()['username'] self.password = test_helper.get_creds()['password'] self.org_type = test_helper.get_creds()['org_type'] self.client = MavensMateClient(credentials={ "username" : self.username, "password" : self.password, "org_type" : self.org_type }) def setUp(self): pass def test_describe(self): print self.client.describeMetadata(retXml=False) def test_bad_login(self): try: self.client = MavensMateClient(credentials={"username":self.username, "password":"******"}) except BaseException, e: self.assertTrue(e.message == 'Server raised fault: \'INVALID_LOGIN: Invalid username, password, security token; or user locked out.\'')
def execute(self): if 'username' not in self.params or self.params['username'] == None or self.params['username'] == '': raise MMException('Please enter a Salesforce.com username') if 'password' not in self.params or self.params['password'] == None or self.params['password'] == '': raise MMException('Please enter a Salesforce.com password') if 'org_type' not in self.params or self.params['org_type'] == None or self.params['org_type'] == '': raise MMException('Please select an org type') if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" not in self.params: raise MMException('To use a custom org type, please include a org_url parameter') if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" in self.params and self.params["org_url"] == "": raise MMException('Please specify the org url') config.logger.debug('=================>') config.logger.debug(self.params) client = MavensMateClient(credentials={ "username" : self.params['username'], "password" : self.params['password'], "org_type" : self.params['org_type'], "org_url" : self.params.get('org_url', None) }) response = { "sid" : client.sid, "user_id" : client.user_id, "metadata_server_url" : client.metadata_server_url, "server_url" : client.server_url, "metadata" : client.get_org_metadata(subscription=self.params.get('subscription', None)), "org_metadata_types" : util.metadata_types(), "success" : True } return util.generate_response(response)
class TestClientOperations(unittest.TestCase): # FYI: overriding this constructor is apparently not recommended, so we should find a better way to init test data def __init__(self, *args, **kwargs): super(TestClientOperations, self).__init__(*args, **kwargs) self.username = test_helper.get_creds()['username'] self.password = test_helper.get_creds()['password'] self.org_type = test_helper.get_creds()['org_type'] self.client = MavensMateClient( credentials={ "username": self.username, "password": self.password, "org_type": self.org_type }) def setUp(self): pass def test_describe(self): print self.client.describeMetadata(retXml=False) def test_bad_login(self): try: self.client = MavensMateClient(credentials={ "username": self.username, "password": "******" }) except BaseException, e: self.assertTrue( e.message == 'Server raised fault: \'INVALID_LOGIN: Invalid username, password, security token; or user locked out.\'' )
def run(self): try: if 'password' not in self.destination: self.destination['password'] = util.get_password_by_key(self.destination['id']) deploy_client = MavensMateClient(credentials={ "username":self.destination['username'], "password":self.destination['password'], "org_type":self.destination['org_type'] }) # Check testRequired to find out if this is a production org. # This is a bit of a misnomer as runAllTests=True will run managed package tests, other # tests are *always* run so we should honor the UI, however Production orgs do require # rollbackOnError=True so we should override it here describe_result = deploy_client.describeMetadata(retXml=False) if describe_result.testRequired == True: self.params['rollback_on_error'] = True self.params['zip_file'] = self.deploy_metadata.zipFile deploy_result = deploy_client.deploy(self.params) deploy_result['username'] = self.destination['username'] debug('>>>>>> DEPLOY RESULT >>>>>>') debug(deploy_result) self.result = deploy_result except BaseException, e: result = util.generate_error_response(e.message, False) result['username'] = self.destination['username'] self.result = result
def test_bad_login(self): try: self.client = MavensMateClient(credentials={ "username": self.username, "password": "******" }) except BaseException, e: self.assertTrue( e.message == 'Server raised fault: \'INVALID_LOGIN: Invalid username, password, security token; or user locked out.\'' )
def __init__(self, *args, **kwargs): super(TestClientOperations, self).__init__(*args, **kwargs) self.username = test_helper.get_creds()['username'] self.password = test_helper.get_creds()['password'] self.org_type = test_helper.get_creds()['org_type'] self.client = MavensMateClient( credentials={ "username": self.username, "password": self.password, "org_type": self.org_type })
def execute(self): if 'sid' in self.params: client = MavensMateClient(credentials={ "sid" : self.params.get('sid', None), "metadata_server_url" : urllib.unquote(self.params.get('metadata_server_url', None)), "server_url" : urllib.unquote(self.params.get('server_url', None)), }) elif 'username' in self.params: client = MavensMateClient(credentials={ "username" : self.params.get('username', None), "password" : self.params.get('password', None), "org_type" : self.params.get('org_type', None), "org_url" : self.params.get('org_url', None) }) return json.dumps(client.list_metadata(self.params['metadata_type']))
def execute(self): if 'username' not in self.params or self.params[ 'username'] == None or self.params['username'] == '': raise MMException('Please enter a Salesforce.com username') if 'password' not in self.params or self.params[ 'password'] == None or self.params['password'] == '': raise MMException('Please enter a Salesforce.com password') if 'org_type' not in self.params or self.params[ 'org_type'] == None or self.params['org_type'] == '': raise MMException('Please select an org type') if 'org_type' in self.params and self.params[ 'org_type'] == "custom" and "org_url" not in self.params: raise MMException( 'To use a custom org type, please include a org_url parameter') if 'org_type' in self.params and self.params[ 'org_type'] == "custom" and "org_url" in self.params and self.params[ "org_url"] == "": raise MMException('Please specify the org url') config.logger.debug('=================>') config.logger.debug(self.params) client = MavensMateClient( credentials={ "username": self.params['username'], "password": self.params['password'], "org_type": self.params['org_type'], "org_url": self.params.get('org_url', None) }) response = { "sid": client.sid, "user_id": client.user_id, "metadata_server_url": client.metadata_server_url, "server_url": client.server_url, "metadata": client.get_org_metadata( subscription=self.params.get('subscription', None)), "org_metadata_types": util.metadata_types(), "success": True } return util.generate_response(response)
def execute(self): if 'sid' in self.params: debug('executing list metadata!!') debug(self.params) client = MavensMateClient(credentials={ "sid" : self.params.get('sid', None), "metadata_server_url" : urllib.unquote(self.params.get('metadata_server_url', None)), "server_url" : urllib.unquote(self.params.get('server_url', None)), }) elif 'username' in self.params: client = MavensMateClient(credentials={ "username" : self.params.get('username', None), "password" : self.params.get('password', None), "org_type" : self.params.get('org_type', None), "org_url" : self.params.get('org_url', None) }) return json.dumps(client.list_metadata(self.params['metadata_type']))
def __init__(self, *args, **kwargs): super(TestClientOperations, self).__init__(*args, **kwargs) self.username = test_helper.get_creds()['username'] self.password = test_helper.get_creds()['password'] self.org_type = test_helper.get_creds()['org_type'] self.client = MavensMateClient(credentials={ "username" : self.username, "password" : self.password, "org_type" : self.org_type })
def __init__(self, *args, **kwargs): super(TestClientOperations, self).__init__(*args, **kwargs) self.username = '******' self.password = '******' self.org_type = 'developer' self.client = MavensMateClient(credentials={ "username" : self.username, "password" : self.password, "org_type" : self.org_type })
def run(self): try: if 'password' not in self.destination: self.destination['password'] = util.get_password_by_key(self.destination['id']) deploy_client = MavensMateClient(credentials={ "username":self.destination['username'], "password":self.destination['password'], "org_type":self.destination['org_type'] }) retrieve_result = deploy_client.retrieve(package=self.package) retrieve_result['username'] = self.destination['username'] debug('>>>>>> RETRIEVE RESULT >>>>>>') debug(retrieve_result) self.result = retrieve_result except BaseException, e: debug('caught exception during compare --->') debug(e.message) result = util.generate_error_response(e.message, False) result['username'] = self.destination['username'] debug(result) self.result = result
def execute(self): c = MavensMateClient(credentials={ "username" : self.params['username'], "password" : self.params['password'], "org_type" : self.params['org_type'] }) org_connection_id = util.new_mavensmate_id() util.put_password_by_key(org_connection_id, self.params['password']) org_connections = GetOrgConnectionsCommand(params=self.params).execute() org_connections.append({ 'id' : org_connection_id, 'username' : self.params['username'], 'environment' : self.params['org_type'] }) src = open(os.path.join(config.project.location,"config",".org_connections"), 'wb') json_data = json.dumps(org_connections, sort_keys=False, indent=4) src.write(json_data) src.close() return util.generate_success_response('Org Connection Successfully Created')
def test_bad_login(self): try: self.client = MavensMateClient(credentials={"username":self.username, "password":"******"}) except BaseException, e: self.assertTrue(e.message == 'Server raised fault: \'INVALID_LOGIN: Invalid username, password, security token; or user locked out.\'')