高章伟
2022-02-24 2aa8da8af66aa8ae00f25831aed6bb0364176e7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@isTest
private class NFM609FiledDownloadBatchTest {
    // 测试Case附件下载
    static testMethod void testMethod1() {
        Case cas = new Case();
        
        // cas.complaintID__c = 'test202193';
        cas.Status = '草案中';
        cas.AttachmentDownload__c = true;
        cas.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/greaterthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip';
        cas.AttachmentName__c = '测试附件下载';
        insert cas;
        // NFM609Schedule.assignOneMinute('Case');
        Database.executeBatch(new NFM609FiledDownloadBatch('Case'), 1);
 
        Test.setMock(HttpCalloutMock.class, new FiledDownloadHttpCallMock());
    }
    // 测试报修子单附件下载
    static testMethod void testMethod2() {
        RepairSubOrder__c subOrder = new RepairSubOrder__c();
        subOrder.AttachmentDownload__c = true;
        subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip';
        subOrder.AttachmentName__c = '测试附件下载';
        insert subOrder;
        // NFM609Schedule.assignOneMinute('Case');
        Database.executeBatch(new NFM609FiledDownloadBatch('RepairSubOrder__c'), 1);
 
        Test.setMock(HttpCalloutMock.class, new FiledDownloadHttpCallMock());
    }
 
    // 测试NFM609Schedule
    static testMethod void testMethod3() {
        RepairSubOrder__c subOrder = new RepairSubOrder__c();
        subOrder.AttachmentDownload__c = true;
        subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip';
        subOrder.AttachmentName__c = '测试附件下载';
        insert subOrder;
        // Database.executeBatch(new NFM609FiledDownloadBatch('RepairSubOrder__c'), 1);
        NFM609Schedule.assignOneMinute('RepairSubOrder__c');
        Test.setMock(HttpCalloutMock.class, new FiledDownloadHttpCallMock());
    }
}