From eeb7c0a2d6f037d515bb822d739036b69c4dc73a Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期五, 08 四月 2022 17:14:12 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG
---
force-app/main/default/classes/FileUploadControllerTest.cls | 62 +++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/FileUploadControllerTest.cls b/force-app/main/default/classes/FileUploadControllerTest.cls
new file mode 100644
index 0000000..dc0e0c2
--- /dev/null
+++ b/force-app/main/default/classes/FileUploadControllerTest.cls
@@ -0,0 +1,62 @@
+@isTest
+private class FileUploadControllerTest {
+ static testMethod void testMethod1() {
+ TestDataUtility.CreatePIPolicyConfiguration('Document');
+ Account acc = new Account(Name = 'test');
+ Map<String,Object> accMap = new Map<String,Object>();
+ accMap.put('Account',acc);
+ accMap.put('object','vjdoneqvds');
+ String mapJson = JSON.serialize(accMap);
+
+ Contact con = TestDataUtility.CreateContacts(1)[0];
+
+ Test.setMock(HttpCalloutMock.class, new TestDataUtility.BaseHttpMock(mapJson,'OK','200'));
+
+ Test.startTest();
+ ApexPages.StandardController sc = new ApexPages.StandardController(con);
+ FileUploadController fuc = new FileUploadController(sc);
+
+ String msg = fuc.PIPL_Input_PDF_Error_Msg;
+ Document doc = fuc.documentData;
+ FileUploadController.Response fur = new FileUploadController.Response();
+ fur.message = '';
+
+ FileUploadController.saveFile('Contact','123','456',fuc.parentId);
+
+ FileAddress__c file = new FileAddress__c();
+ PIHelper.PIIntegration pI=PIHelper.getPIIntegrationInfo('Document');
+ file.DownloadLink__c =pI.undeleteUrl+'123'+'&fileName='+'Contact';
+ file.FileName__c ='Contact';
+ file.ViewLink__c =pI.queryUrl+'123';
+ file.ParentRecordId__c =fuc.parentId;
+ file.AWS_File_Key__c = '123';
+ insert file;
+
+ FileUploadController.saveFile('Contact','123','456',fuc.parentId);
+ fuc.refreshFiles();
+ fuc.parentId = '';
+ fuc.refreshFiles();
+ try{
+ delete file;
+ }catch(Exception e){
+ system.debug('Exception from delete file:'+e.getmessage());
+ }
+ Test.stopTest();
+ }
+ static testMethod void testMethod2() {
+ TestDataUtility.CreatePIPolicyConfiguration('Document');
+ Account acc = new Account(Name = 'test');
+ Map<String,Object> accMap = new Map<String,Object>();
+ accMap.put('Account',acc);
+ accMap.put('object','vjdoneqvds');
+ String mapJson = JSON.serialize(accMap);
+
+ Test.setMock(HttpCalloutMock.class, new TestDataUtility.BaseHttpMock(mapJson,'OK','200'));
+
+ Test.startTest();
+ // throw new DMLException('insert false for test');
+ FileUploadController.saveFile('','','','');
+
+ Test.stopTest();
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.1