Example #1
0
    def test_compile_apex(self):
        print '>>> attempting bad compile of apex class'
        compile_result = self.client.compile_apex(
            'class', 'public this_wont_compile { }')
        self.assertTrue(compile_result.success == False)

        print '>>> attempting good compile of apex class'
        compile_result = self.client.compile_apex(
            'class', 'public class this_will_compile { }')
        self.assertTrue(compile_result.success == True)

        print '>>> attempting bad compile of apex trigger'
        compile_result = self.client.compile_apex(
            'trigger',
            'trigger mavensmate_test_trigger on Accounttt (before insert) { }')
        self.assertTrue(compile_result.success == False)

        print '>>> attempting good compile of apex trigger'
        compile_result = self.client.compile_apex(
            'trigger',
            'trigger mavensmate_test_trigger on Account (before insert) { }')
        self.assertTrue(compile_result.success == True)

        trigger_id = self.client.get_apex_entity_id_by_name(
            object_type="ApexTrigger", name="mavensmate_test_trigger")
        self.assertTrue(len(trigger_id) == 18)

        helper.delete_metadata(
            self.client, {
                'ApexClass': ['this_will_compile'],
                'ApexTrigger': ['mavensmate_test_trigger']
            })
Example #2
0
 def test_server_dupe_check(self):
     self.assertFalse(
         self.client.does_metadata_exist(object_type="ApexClass",
                                         name="this_wont_be_found"))
     compile_result = self.client.compile_apex(
         'class', 'public class this_will_compile { }')
     self.assertTrue(compile_result.success == True)
     self.assertTrue(
         self.client.does_metadata_exist(object_type="ApexClass",
                                         name="this_will_compile"))
     helper.delete_metadata(self.client,
                            {'ApexClass': ['this_will_compile']})
 def test_create_new_apex_component(self):
     config.connection.new_project(params={
         "project_name"    : self.project_name,
         "username"        : self.username,
         "password"        : self.password,
         "org_type"        : self.org_type,
         "package"         : config.base_path+'/test/resources/package.xml' #=> this should be a dict of package contents or the location of a package.xml
     },action='new')
     deploy_result = config.connection.project.new_metadata(
         api_name                        = 'apex_component_from_unit_test_123',
         metadata_type                   = 'ApexComponent'
     )
     print deploy_result
     self.assertTrue(deploy_result.success == True)
     helper.delete_metadata(config.connection.project.sfdc_client, {'ApexComponent':['apex_component_from_unit_test_123']})
 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
Example #5
0
 def test_create_new_apex_page(self):
     config.connection.new_project(
         params={
             "project_name": self.project_name,
             "username": self.username,
             "password": self.password,
             "org_type": self.org_type,
             "package": config.base_path +
             '/test/resources/package.xml'  #=> this should be a dict of package contents or the location of a package.xml
         },
         action='new')
     deploy_result = config.connection.project.new_metadata(
         api_name='apex_page_from_unit_test_123', metadata_type='ApexPage')
     print deploy_result
     self.assertTrue(deploy_result.success == True)
     helper.delete_metadata(config.connection.project.sfdc_client,
                            {'ApexPage': ['apex_page_from_unit_test_123']})
Example #6
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
Example #7
0
    def test_compile_apex(self):        
        print '>>> attempting bad compile of apex class'
        compile_result = self.client.compile_apex('class', 'public this_wont_compile { }')
        self.assertTrue(compile_result.success == False)
        
        print '>>> attempting good compile of apex class'
        compile_result = self.client.compile_apex('class', 'public class this_will_compile { }')
        self.assertTrue(compile_result.success == True)
        
        print '>>> attempting bad compile of apex trigger'
        compile_result = self.client.compile_apex('trigger', 'trigger mavensmate_test_trigger on Accounttt (before insert) { }')
        self.assertTrue(compile_result.success == False)

        print '>>> attempting good compile of apex trigger'
        compile_result = self.client.compile_apex('trigger', 'trigger mavensmate_test_trigger on Account (before insert) { }')
        self.assertTrue(compile_result.success == True)

        trigger_id = self.client.get_apex_entity_id_by_name(object_type="ApexTrigger", name="mavensmate_test_trigger")
        self.assertTrue(len(trigger_id) == 18)

        helper.delete_metadata(self.client, {'ApexClass':['this_will_compile'], 'ApexTrigger':['mavensmate_test_trigger']})
Example #8
0
 def test_server_dupe_check(self):
     self.assertFalse(self.client.does_metadata_exist(object_type="ApexClass", name="this_wont_be_found"))
     compile_result = self.client.compile_apex('class', 'public class this_will_compile { }')
     self.assertTrue(compile_result.success == True)
     self.assertTrue(self.client.does_metadata_exist(object_type="ApexClass", name="this_will_compile"))
     helper.delete_metadata(self.client, {'ApexClass':['this_will_compile']})