Esempio n. 1
0
 def test_05_update_debug_settings(self): 
     commandOut = self.redirectStdOut()
     stdin = {
         "project_name"      : "unit test tooling project",
         "debug_categories"  : {
             "Workflow"      : "FINE", 
             "Callout"       : "FINE", 
             "System"        : "FINE", 
             "Database"      : "FINE", 
             "ApexCode"      : "FINE", 
             "Validation"    : "FINE", 
             "Visualforce"   : "FINE"
         },
         "expiration"        : 120
     }
     request.get_request_payload = mock.Mock(return_value=stdin)
     sys.argv = ['mm.py', '-o', 'update_debug_settings']
     MavensMateRequestHandler().execute()
     mm_response = commandOut.getvalue()
     sys.stdout = self.saved_stdout
     print mm_response
     mm_json_response = util.parse_mm_response(mm_response)
     new_debug_settings = util.parse_json_file(os.path.join(base_test_directory, "test_workspace", stdin["project_name"], "config", ".debug"))
     self.assertTrue(new_debug_settings['expiration'] == stdin["expiration"])
     self.assertTrue(new_debug_settings['levels']['Workflow'] == stdin["debug_categories"]["Workflow"])
     self.assertTrue(new_debug_settings['levels']['Visualforce'] == stdin["debug_categories"]["Visualforce"])
Esempio n. 2
0
 def test_03_update_debug_settings(self): 
     commandOut = self.redirectStdOut()
     stdin = {
         "project_name"      : "unit test tooling project",
         "debug_categories"  : {
             "Workflow"      : "FINE", 
             "Callout"       : "FINE", 
             "System"        : "FINE", 
             "Database"      : "FINE", 
             "ApexCode"      : "FINE", 
             "Validation"    : "FINE", 
             "Visualforce"   : "FINE"
         },
         "expiration"        : 120
     }
     mm_util.get_request_payload = mock.Mock(return_value=stdin)
     sys.argv = ['mm.py', '-o', 'update_debug_settings']
     mm.main()
     mm_response = commandOut.getvalue()
     sys.stdout = self.saved_stdout
     #print mm_response
     mm_json_response = util.parse_mm_response(mm_response)
     new_debug_settings = util.parse_json_file(os.path.join(base_test_directory, "test_workspace", stdin["project_name"], "config", ".debug"))
     self.assertTrue(new_debug_settings['expiration'] == stdin["expiration"])
     self.assertTrue(new_debug_settings['levels']['Workflow'] == stdin["debug_categories"]["Workflow"])
     self.assertTrue(new_debug_settings['levels']['Visualforce'] == stdin["debug_categories"]["Visualforce"])
Esempio n. 3
0
def get_fixture_response(command_name_or_argv):
    if type(command_name_or_argv) is list:
        command_name = command_name_or_argv[2]
    else:
        command_name = command_name_or_argv 
    try:
        return util.parse_json_file(os.path.join(base_test_directory,'lib','fixtures',command_name+'.json'))
    except:
        return mmutil.generate_error_response('Could not find test fixture response for command: '+command_name)
Esempio n. 4
0
def get_fixture_response(command_name_or_argv):
    if type(command_name_or_argv) is list:
        command_name = command_name_or_argv[2]
    else:
        command_name = command_name_or_argv
    try:
        return util.parse_json_file(
            os.path.join(base_test_directory, 'lib', 'fixtures',
                         command_name + '.json'))
    except:
        return mmutil.generate_error_response(
            'Could not find test fixture response for command: ' +
            command_name)
Esempio n. 5
0
 def test_05_update_project_subscription(self):
     commandOut = self.redirectStdOut()
     stdin = {
         "subscription" : ["ApexPage","ApexComponent"], 
         "project_name" : "unit test project" 
     }
     mm_util.get_request_payload = mock.Mock(return_value=stdin)
     sys.argv = ['mm.py', '-o', 'update_subscription']
     mm.main()
     mm_response = commandOut.getvalue()
     sys.stdout = self.saved_stdout
     mm_json_response = util.parse_mm_response(mm_response)
     self.assertTrue(mm_json_response['success'] == True)
     project_settings = util.parse_json_file(os.path.join(base_test_directory, 'test_workspace', 'unit test project', 'config', '.settings'))
     self.assertTrue(type(project_settings['subscription']) is list and len(project_settings['subscription']) == 2)
     self.assertTrue(project_settings['subscription'][0] == "ApexPage")
     self.assertTrue(project_settings['subscription'][1] == "ApexComponent")
Esempio n. 6
0
 def test_05_should_update_debug_settings(self): 
     stdin = {
         "project_name"      : "unit test tooling project",
         "debug_categories"  : {
             "Workflow"      : "FINE", 
             "Callout"       : "FINE", 
             "System"        : "FINE", 
             "Database"      : "FINE", 
             "ApexCode"      : "FINE", 
             "Validation"    : "FINE", 
             "Visualforce"   : "FINE"
         },
         "expiration"        : 120
     }
     mm_response = self.runCommand('update_debug_settings', stdin)
     new_debug_settings = util.parse_json_file(os.path.join(base_test_directory, "test_workspace", stdin["project_name"], "config", ".debug"))
     self.assertTrue(new_debug_settings['expiration'] == stdin["expiration"])
     self.assertTrue(new_debug_settings['levels']['Workflow'] == stdin["debug_categories"]["Workflow"])
     self.assertTrue(new_debug_settings['levels']['Visualforce'] == stdin["debug_categories"]["Visualforce"])
Esempio n. 7
0
 def test_05_should_update_debug_settings(self):
     stdin = {
         "project_name": "unit test tooling project",
         "debug_categories": {
             "Workflow": "FINE",
             "Callout": "FINE",
             "System": "FINE",
             "Database": "FINE",
             "ApexCode": "FINE",
             "Validation": "FINE",
             "Visualforce": "FINE"
         },
         "expiration": 120
     }
     mm_response = self.runCommand('update_debug_settings', stdin)
     new_debug_settings = util.parse_json_file(
         os.path.join(base_test_directory, "test_workspace",
                      stdin["project_name"], "config", ".debug"))
     self.assertTrue(
         new_debug_settings['expiration'] == stdin["expiration"])
     self.assertTrue(new_debug_settings['levels']['Workflow'] ==
                     stdin["debug_categories"]["Workflow"])
     self.assertTrue(new_debug_settings['levels']['Visualforce'] ==
                     stdin["debug_categories"]["Visualforce"])