コード例 #1
0
ファイル: create_tests.py プロジェクト: tiaank/mm
    def test_02_delete_apex_class(self): 
        commandOut = self.redirectStdOut()
        client_settings = mm_util.parse_json_from_file(os.path.join(base_test_directory, "user_client_settings.json"))
        stdin = {
            "files": [os.path.join(client_settings["mm_workspace"],"unit test metadata project","src","classes","unittestapexclass.cls")], 
            "project_name": "unit test metadata project"
        }

        mm_util.get_request_payload = mock.Mock(return_value=stdin)
        sys.argv = ['mm.py', '-o', 'delete']
        mm.main()
        mm_response = commandOut.getvalue()
        sys.stdout = self.saved_stdout
        print mm_response
        mm_json_response = util.parse_mm_response(mm_response)
        self.assertTrue(mm_json_response['success'] == True)
コード例 #2
0
ファイル: create_tests.py プロジェクト: vazexqi/mm
 def test_02_compile_apex_class(self): 
     test_helper.create_project("unit test metadata project")
     commandOut = self.redirectStdOut()
     client_settings = mm_util.parse_json_from_file(os.path.join(base_test_directory, "user_client_settings.json"))
     stdin = {
         "project_name": "unit test metadata project", 
         "files": [os.path.join(client_settings["mm_workspace"],"unit test metadata project","src","classes","unittestapexclass.cls")] 
     }
     mm_util.get_request_payload = mock.Mock(return_value=stdin)
     sys.argv = ['mm.py', '-o', 'compile']
     mm.main()
     mm_response = commandOut.getvalue()
     sys.stdout = self.saved_stdout
     #print mm_response
     mm_json_response = util.parse_mm_response(mm_response)
     self.assertTrue(mm_json_response['State'] == "Completed")
     self.assertTrue(mm_json_response['ErrorMsg'] == None)
コード例 #3
0
ファイル: freeze_osx.py プロジェクト: Oblongmana/MavensMate
#this scripts freezes mm.py and places it in the dist directory
import sys
import argparse
import shutil
import os
import subprocess
import pipes
sys.path.append('../')
import lib.mm_util as mm_util

mavensmate_path     = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
pyinstaller_path    = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))+"/tools/pyinstaller-dev"
mm_path             = os.path.dirname(os.path.dirname(__file__))
mm_build_path       = os.path.dirname(__file__)
build_settings      = mm_util.parse_json_from_file('build_settings.json')

def main():
    #remove dist directory
    if os.path.exists("{0}/dist".format(mm_path)):
        shutil.rmtree("{0}/dist".format(mm_path))
    
    #remove mm directory from pyinstaller
    if os.path.exists(pyinstaller_path+"/mm"):
        shutil.rmtree(pyinstaller_path+"/mm")

    #run pyinstaller on mm.py
    os.chdir(pyinstaller_path)
    pyinstaller_command = "{0} pyinstaller.py {1} --onedir {2}".format(
        pipes.quote(build_settings['python_location']), 
        pipes.quote(mm_path+"/mm.py"), 
        pipes.quote(mm_path+"/mm.spec"))
コード例 #4
0
#this scripts freezes mm.py and places it in the dist directory
import sys
import argparse
import shutil
import os
import subprocess
import pipes
sys.path.append('../')
import lib.mm_util as mm_util

mavensmate_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
pyinstaller_path = os.path.dirname(os.path.dirname(
    os.path.dirname(__file__))) + "/tools/pyinstaller-dev"
mm_path = os.path.dirname(os.path.dirname(__file__))
mm_build_path = os.path.dirname(__file__)
build_settings = mm_util.parse_json_from_file('build_settings.json')


def main():
    #remove dist directory
    if os.path.exists("{0}/dist".format(mm_path)):
        shutil.rmtree("{0}/dist".format(mm_path))

    #remove mm directory from pyinstaller
    if os.path.exists(pyinstaller_path + "/mm"):
        shutil.rmtree(pyinstaller_path + "/mm")

    #run pyinstaller on mm.py
    os.chdir(pyinstaller_path)
    pyinstaller_command = "{0} pyinstaller.py {1} --onedir {2}".format(
        pipes.quote(build_settings['python_location']),
コード例 #5
0
ファイル: test_helper.py プロジェクト: chrishowes/mm
 def get_plugin_client_settings(self):
     settings = {}
     settings['default']     = mm_util.parse_json_from_file(os.path.join(os.path.dirname(__file__),"default_client_settings.json"))
     settings['user']        = mm_util.parse_json_from_file(os.path.join(os.path.dirname(__file__),"user_client_settings.json"))
     return settings
コード例 #6
0
import shutil
import os
import subprocess
import pipes

# path variables
mavensmate_path     = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir))
pyinstaller_path    = mavensmate_path+"/tools/pyinstaller-dev"
mm_path             = mavensmate_path+"/mm"
mm_build_path       = mm_path+"/build"

# add mm directory and import lib.mm_util
sys.path.append(mavensmate_path+"/mm")
import lib.mm_util as mm_util

build_settings      = mm_util.parse_json_from_file(mm_build_path+'/build_settings.json')

def main():
    #remove dist directory
    if os.path.exists("{0}/dist".format(mm_path)):
        shutil.rmtree("{0}/dist".format(mm_path))
    
    #remove mm directory from pyinstaller
    if os.path.exists(pyinstaller_path+"/mm"):
        shutil.rmtree(pyinstaller_path+"/mm")

    #get the build settings, or if it doesn't exist use which to find python
    if "python_location" in build_settings and os.path.exists(build_settings["python_location"]):
        python_location = build_settings["python_location"]
    else:
        cmd = "which python"
コード例 #7
0
import subprocess
import pipes

# path variables
mavensmate_path = os.path.abspath(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir,
                 os.pardir))
pyinstaller_path = mavensmate_path + "/tools/pyinstaller-dev"
mm_path = mavensmate_path + "/mm"
mm_build_path = mm_path + "/build"

# add mm directory and import lib.mm_util
sys.path.append(mavensmate_path + "/mm")
import lib.mm_util as mm_util

build_settings = mm_util.parse_json_from_file(mm_build_path +
                                              '/build_settings.json')


def main():
    #remove dist directory
    if os.path.exists("{0}/dist".format(mm_path)):
        shutil.rmtree("{0}/dist".format(mm_path))

    #remove mm directory from pyinstaller
    if os.path.exists(pyinstaller_path + "/mm"):
        shutil.rmtree(pyinstaller_path + "/mm")

    #get the build settings, or if it doesn't exist use which to find python
    if "python_location" in build_settings and os.path.exists(
            build_settings["python_location"]):
        python_location = build_settings["python_location"]
コード例 #8
0
ファイル: checkpoint_tests.py プロジェクト: vazexqi/mm
    def test_02_new_apex_checkpoint(self): 
        test_helper.create_project("unit test tooling project")
        commandOut = self.redirectStdOut()

        ###CREATE APEX CLASS
        stdin = {
            "github_template": {
                "author": "MavensMate", 
                "description": "The default template for an Apex Class", 
                "name": "Default", 
                "file_name": "ApexClass.cls"
            }, 
            "apex_trigger_object_api_name": None, 
            "apex_class_type": None, 
            "api_name": "unittesttoolingapexclass", 
            "project_name": "unit test tooling project", 
            "metadata_type": "ApexClass"
        }
        mm_util.get_request_payload = mock.Mock(return_value=stdin)
        sys.argv = ['mm.py', '-o', 'new_metadata']
        mm.main()
        mm_response = commandOut.getvalue()
        sys.stdout = self.saved_stdout
        print mm_response
        mm_json_response = util.parse_mm_response(mm_response)
        self.assertTrue(mm_json_response['success'] == True)
        self.assertTrue('id' in mm_json_response and len(mm_json_response['id']) is 18)

        ###CREATE CHECKPOINT
        stdin = {
            "project_name"      : "unit test tooling project",
            "IsDumpingHeap"     : True, 
            "Iteration"         : 1, 
            "Object_Type"       : "ApexClass", 
            "Line"              : 1,
            "ActionScriptType"  : "None", 
            "API_Name"          : "unittesttoolingapexclass"
        }
        mm_util.get_request_payload = mock.Mock(return_value=stdin)
        sys.argv = ['mm.py', '-o', 'new_apex_overlay']
        mm.main()
        mm_response = commandOut.getvalue()
        sys.stdout = self.saved_stdout
        print mm_response
        mm_json_response = util.parse_mm_response(mm_response)
        self.assertTrue(mm_json_response['success'] == True)
        self.assertTrue('id' in mm_json_response and len(mm_json_response['id']) is 18)

        ###DELETE CLASS
        client_settings = mm_util.parse_json_from_file(os.path.join(base_test_directory, "user_client_settings.json"))
        stdin = {
            "files": [os.path.join(client_settings["mm_workspace"],"unit test tooling project","src","classes","unittesttoolingapexclass.cls")], 
            "project_name": "unit test tooling project"
        }

        mm_util.get_request_payload = mock.Mock(return_value=stdin)
        sys.argv = ['mm.py', '-o', 'delete']
        mm.main()
        mm_response = commandOut.getvalue()
        sys.stdout = self.saved_stdout
        print mm_response
        mm_json_response = util.parse_mm_response(mm_response)
        self.assertTrue(mm_json_response['success'] == True)