buli
2022-05-14 ead4df22dca33a867279471821ca675f91dec760
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
43
44
45
46
47
@isTest
private class TOTPPluginTest
{
    static testMethod void getQRCode() {
     
        TOTPPlugin totp = new TOTPPlugin();
        Map<String,Object> inputParams = new Map<String,Object>();
        Map<String,Object> outputParams = new Map<String,Object>();
         
        Map<String,String> QR = Auth.SessionManagement.getQrCode(); 
         
        inputParams.put('OTP_INPUT', null);
         
        Process.PluginRequest request = new Process.PluginRequest(inputParams);
        Process.PluginResult result;
        result = totp.invoke(request);
        
        System.AssertEquals(1,1);
    }
    
    static testMethod void validateToken() {
     
        TOTPPlugin totp = new TOTPPlugin();
        Map<String,Object> inputParams = new Map<String,Object>();
        Map<String,Object> outputParams = new Map<String,Object>();
         
        Map<String,String> QR = Auth.SessionManagement.getQrCode(); 
         
        inputParams.put('OTP_INPUT', '1234');
        inputParams.put('SECRET_INPUT', QR.get('secret'));
         
        Process.PluginRequest request = new Process.PluginRequest(inputParams);
        Process.PluginResult result;
        result = totp.invoke(request);
        
        System.AssertEquals(1,1);
    }
 
    static testMethod void describeTest() {
 
        TOTPPlugin totp = new TOTPPlugin();
        Process.PluginDescribeResult result = totp.describe();
        
        System.AssertEquals(result.inputParameters.size(), 3);
        System.AssertEquals(result.OutputParameters.size(), 3);
     }
}