Пример #1
0
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 = '******'
        self.password = '******'
        self.org_type = 'developer'
        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.\''
            )
Пример #2
0
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 = '******'
        self.password = '******'
        self.org_type = 'developer' 
        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.\'')
Пример #3
0
def get_active_session():
    try:
        if 'username' not in request_payload or request_payload['username'] == None or request_payload['username'] == '':
            raise MMException('Please enter a Salesforce.com username')
        if 'password' not in request_payload or request_payload['password'] == None or request_payload['password'] == '':
            raise MMException('Please enter a Salesforce.com password')
        if 'org_type' not in request_payload or request_payload['org_type'] == None or request_payload['org_type'] == '':
            raise MMException('Please select an org type')

        client = MavensMateClient(credentials={
            "username" : request_payload['username'],
            "password" : request_payload['password'],
            "org_type" : request_payload['org_type']
        }) 
        
        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(),
            "success"               : True
        }
        print util.generate_response(response)
    except BaseException, e:
        print util.generate_error_response(e.message)
Пример #4
0
def list_metadata():
    client = MavensMateClient(credentials={
        "sid"                   : request_payload.get('sid', None),
        "metadata_server_url"   : urllib.unquote(request_payload.get('metadata_server_url', None)),
        "server_url"            : urllib.unquote(request_payload.get('server_url', None)),
    }) 
    print json.dumps(client.list_metadata(request_payload['metadata_type']))
Пример #5
0
Файл: mm.py Проект: e-bacho/mm
    def get_active_session(self):
        try:
            if 'username' not in self.payload or self.payload['username'] == None or self.payload['username'] == '':
                raise MMException('Please enter a Salesforce.com username')
            if 'password' not in self.payload or self.payload['password'] == None or self.payload['password'] == '':
                raise MMException('Please enter a Salesforce.com password')
            if 'org_type' not in self.payload or self.payload['org_type'] == None or self.payload['org_type'] == '':
                raise MMException('Please select an org type')
            if 'org_type' in self.payload and self.payload['org_type'] == "custom" and "org_url" not in self.payload:
                raise MMException('To use a custom org type, please include a org_url parameter') 
            if 'org_type' in self.payload and self.payload['org_type'] == "custom" and "org_url" in self.payload and self.payload["org_url"] == "":
                raise MMException('Please specify the org url')    

            client = MavensMateClient(credentials={
                "username" : self.payload['username'],
                "password" : self.payload['password'],
                "org_type" : self.payload['org_type'],
                "org_url"  : self.payload.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.payload.get('subscription', None)),
                "success"               : True
            }
            print util.generate_response(response)
        except BaseException, e:
            print util.generate_error_response(e.message)
Пример #6
0
def get_active_session():
    try:
        if 'username' not in request_payload or request_payload['username'] == None or request_payload['username'] == '':
            raise MMException('Please enter a Salesforce.com username')
        if 'password' not in request_payload or request_payload['password'] == None or request_payload['password'] == '':
            raise MMException('Please enter a Salesforce.com password')
        if 'org_type' not in request_payload or request_payload['org_type'] == None or request_payload['org_type'] == '':
            raise MMException('Please select an org type')

        client = MavensMateClient(credentials={
            "username" : request_payload['username'],
            "password" : request_payload['password'],
            "org_type" : request_payload['org_type']
        }) 
        
        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(),
            "success"               : True
        }
        print util.generate_response(response)
    except BaseException, e:
        print util.generate_error_response(e.message)
Пример #7
0
 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
         })
Пример #8
0
def list_metadata():
    client = MavensMateClient(
        credentials={
            "sid":
            request_payload.get('sid', None),
            "metadata_server_url":
            urllib.unquote(request_payload.get('metadata_server_url', None)),
            "server_url":
            urllib.unquote(request_payload.get('server_url', None)),
        })
    print json.dumps(client.list_metadata(request_payload['metadata_type']))
Пример #9
0
 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.\''
         )
Пример #10
0
Файл: mm.py Проект: e-bacho/mm
 def list_metadata(self):
     if 'sid' in self.payload:
         client = MavensMateClient(credentials={
             "sid"                   : self.payload.get('sid', None),
             "metadata_server_url"   : urllib.unquote(self.payload.get('metadata_server_url', None)),
             "server_url"            : urllib.unquote(self.payload.get('server_url', None)),
         }) 
     elif 'username' in self.payload:
         client = MavensMateClient(credentials={
             "username"              : self.payload.get('username', None),
             "password"              : self.payload.get('password', None),
             "org_type"              : self.payload.get('org_type', None),
             "org_url"               : self.payload.get('org_url', None)
         })
     print json.dumps(client.list_metadata(self.payload['metadata_type']))
Пример #11
0
class TestToolingAPI(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(TestToolingAPI, 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 setUp(self):
        pass

    def test_overlay_actions(self):
        payload = {
            "ActionScriptType": "None",
            "ExecutableEntityId": "01pd0000001yXtYAAU",
            "IsDumpingHeap": True,
            "Iteration": 1,
            "Line": 3,
            "ScopeId": "005d0000000xxzsAAA"
        }
        list_result = self.client.get_overlay_actions(id='01pd0000001yXtYAAU')
        print list_result

        create_result = self.client.create_overlay_action(payload)
        print create_result

        list_result = self.client.get_overlay_actions(id='01pd0000001yXtYAAU')
        print list_result

        # delete_result = self.client.remove_overlay_action(id='01pd0000001yXtYAAU', line_number=3)
        # print delete_result

        # list_result = self.client.get_overlay_actions(id='01pd0000001yXtYAAU')
        # print list_result

    def tearDown(self):
        pass
Пример #12
0
class TestToolingAPI(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(TestToolingAPI, 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 setUp(self):
        pass

    def test_overlay_actions(self):
        payload = {
            "ActionScriptType" : "None",
            "ExecutableEntityId" : "01pd0000001yXtYAAU",
            "IsDumpingHeap" : True,
            "Iteration" : 1,
            "Line" : 3,
            "ScopeId" : "005d0000000xxzsAAA"
        }
        list_result = self.client.get_overlay_actions(id='01pd0000001yXtYAAU')
        print list_result

        create_result = self.client.create_overlay_action(payload)
        print create_result

        list_result = self.client.get_overlay_actions(id='01pd0000001yXtYAAU')
        print list_result

        # delete_result = self.client.remove_overlay_action(id='01pd0000001yXtYAAU', line_number=3)
        # print delete_result

        # list_result = self.client.get_overlay_actions(id='01pd0000001yXtYAAU')
        # print list_result

    def tearDown(self):
        pass
Пример #13
0
 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
     })
Пример #14
0
 def setUp(self):
     config.connection = MavensMatePluginConnection(client='Sublime Text')
     if os.path.exists(config.connection.workspace +
                       "/MavensMateUnitTestProject"):
         shutil.rmtree(config.connection.workspace +
                       "/MavensMateUnitTestProject")
     temp_client = MavensMateClient(credentials={
         "username": self.username,
         "password": self.password
     })
     if self.RunInitialDelete:
         helper.delete_metadata(
             temp_client, {
                 'ApexClass': ['apex_class_from_unit_test_123'],
                 'ApexTrigger': ['apex_trigger_from_unit_test_123'],
                 'ApexPage': ['apex_page_from_unit_test_123'],
                 'ApexComponent': ['apex_component_from_unit_test_123']
             })
         self.__class__.RunInitialDelete = False
Пример #15
0
import sys
import pprint

sys.path.append('../')
sys.path.append('../../')

from lib.mm_connection import MavensMatePluginConnection
from lib.mm_client import MavensMateClient

params = {
	"client" 		: "SUBLIME_TEXT_3"
}
connection = MavensMatePluginConnection(params)

client = MavensMateClient(credentials={
    "username" : '*****@*****.**',
    "password" : 'Rg3skins',
    "org_type" : 'sandbox'
})

package = {
	"Workflow" 	: "*"
}

#r = client.list_metadata_basic('CustomObject')
#r = client.retrieve(package=package)
r = client.list_metadata("Workflow")
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(r)
Пример #16
0
 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.\'')
Пример #17
0
import sys
import pprint

sys.path.append('../')
sys.path.append('../../')

from lib.mm_connection import MavensMatePluginConnection
from lib.mm_client import MavensMateClient

params = {
	"client" 		: "SUBLIME_TEXT_3"
}
connection = MavensMatePluginConnection(params)

client = MavensMateClient(credentials={
    "username" : '*****@*****.**',
    "password" : 'force',
    "org_type" : 'production'
})

package = {
	"ApexClass" 	: "*"
}

#r = client.list_metadata_basic('CustomObject')
#r = client.retrieve(package=package)
#r = client.list_metadata("Workflow")
r = client.retrieve(package=package)
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(r)
Пример #18
0
import sys
import pprint

sys.path.append('../')
sys.path.append('../../')

from lib.mm_connection import MavensMatePluginConnection
from lib.mm_client import MavensMateClient

params = {
    "client"        : "SUBLIME_TEXT_3"
}
connection = MavensMatePluginConnection(params)

client = MavensMateClient(credentials={
    "username" : '*****@*****.**',
    "password" : 'force',
    "org_type" : 'production'
})

#r = client.list_metadata_basic('CustomObject')
#r = client.retrieve(package=package)
r = client.list_metadata("ApexClass", True)
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(r)
print(r[0]['id'])