def test_02_bad_compile(self): client_settings = mmutil.parse_json_from_file( os.path.join(test_helper.base_test_directory, "user_client_settings.json")) commandOut = self.redirectStdOut() src = open( os.path.join(client_settings["mm_workspace"], "unit test metadata project", "src", "classes", "unittestapexclass.cls"), "w") src.write( 'public class unittestapexclass { public unittestapexclass() { String foo } }' ) src.close() test_helper.compile("unit test metadata project", [ os.path.join(client_settings["mm_workspace"], "unit test metadata project", "src", "classes", "unittestapexclass.cls") ]) mm_response = commandOut.getvalue() sys.stdout = self.saved_stdout print mm_response mm_json_response = test_util.parse_mm_response(mm_response) self.assertTrue(mm_json_response['State'] == 'Failed') commandOut = self.redirectStdOut() test_helper.delete_apex_metadata("unit test metadata project", [ os.path.join(client_settings["mm_workspace"], "unit test metadata project", "src", "classes", "unittestapexclass.cls") ])
def test_01_compile_with_tooling_api(self): client_settings = mmutil.parse_json_from_file( os.path.join(test_helper.base_test_directory, "user_client_settings.json") ) test_helper.create_project("unit test metadata project") test_helper.create_apex_metadata("unit test metadata project", "ApexClass", "unittestapexclass") commandOut = self.redirectStdOut() test_helper.compile( "unit test metadata project", [ os.path.join( client_settings["mm_workspace"], "unit test metadata project", "src", "classes", "unittestapexclass.cls", ) ], ) mm_response = commandOut.getvalue() sys.stdout = self.saved_stdout print mm_response mm_json_response = test_util.parse_mm_response(mm_response) self.assertTrue(mm_json_response["State"] == "Completed") self.assertTrue(mm_json_response["CompilerErrors"] == "[]")
def test_02_should_be_a_bad_compile(self): src = open(os.path.join(test_helper.base_test_directory,"test_workspace","unit test metadata project","src","classes","unittestapexclass.cls"), "w") src.write('public class unittestapexclass { public unittestapexclass() { String foo } }') src.close() mm_response = test_helper.compile(self, "unit test metadata project", [os.path.join(test_helper.base_test_directory,"test_workspace","unit test metadata project","src","classes","unittestapexclass.cls")]) self.assertTrue(mm_response['State'] == 'Failed') result = test_helper.delete_apex_metadata(self, "unit test metadata project", [os.path.join(test_helper.base_test_directory,"test_workspace","unit test metadata project","src","classes","unittestapexclass.cls")])
def test_02_bad_compile(self): client_settings = mmutil.parse_json_from_file( os.path.join(test_helper.base_test_directory, "user_client_settings.json") ) commandOut = self.redirectStdOut() src = open( os.path.join( client_settings["mm_workspace"], "unit test metadata project", "src", "classes", "unittestapexclass.cls" ), "w", ) src.write("public class unittestapexclass { public unittestapexclass() { String foo } }") src.close() test_helper.compile( "unit test metadata project", [ os.path.join( client_settings["mm_workspace"], "unit test metadata project", "src", "classes", "unittestapexclass.cls", ) ], ) mm_response = commandOut.getvalue() sys.stdout = self.saved_stdout print mm_response mm_json_response = test_util.parse_mm_response(mm_response) self.assertTrue(mm_json_response["State"] == "Failed") commandOut = self.redirectStdOut() test_helper.delete_apex_metadata( "unit test metadata project", [ os.path.join( client_settings["mm_workspace"], "unit test metadata project", "src", "classes", "unittestapexclass.cls", ) ], )
def test_01_compile_with_tooling_api(self): client_settings = mmutil.parse_json_from_file( os.path.join(test_helper.base_test_directory, "user_client_settings.json")) test_helper.create_project("unit test metadata project") test_helper.create_apex_metadata("unit test metadata project", "ApexClass", "unittestapexclass") commandOut = self.redirectStdOut() test_helper.compile("unit test metadata project", [ os.path.join(client_settings["mm_workspace"], "unit test metadata project", "src", "classes", "unittestapexclass.cls") ]) mm_response = commandOut.getvalue() sys.stdout = self.saved_stdout print mm_response mm_json_response = test_util.parse_mm_response(mm_response) self.assertTrue(mm_json_response['State'] == 'Completed') self.assertTrue(mm_json_response['CompilerErrors'] == '[]')
def test_01_should_compile_with_tooling_api(self): test_helper.create_project(self, "unit test metadata project") test_helper.create_apex_metadata(self, "unit test metadata project", "ApexClass", "unittestapexclass") mm_response = test_helper.compile(self, "unit test metadata project", [os.path.join(test_helper.base_test_directory,"test_workspace","unit test metadata project","src","classes","unittestapexclass.cls")]) self.assertTrue(mm_response['State'] == 'Completed') if self.getTestApiVersion() <= 30: self.assertTrue(mm_response['CompilerErrors'] == '[]') else: self.assertTrue('DeployDetails' in mm_response) self.assertTrue(mm_response['DeployDetails']['componentSuccesses'] == [])