41 lines
1.7 KiB
OpenEdge ABL
41 lines
1.7 KiB
OpenEdge ABL
@isTest
|
|
public class UpdateRefreshToken_Test {
|
|
@isTest
|
|
static void testUpdateRefreshToken(){
|
|
HIC_ShopifySync__Configuration__c col = new HIC_ShopifySync__Configuration__c();
|
|
col.Name = 'Default';
|
|
insert col;
|
|
|
|
UpdateRefreshToken reqst=new UpdateRefreshToken();
|
|
|
|
String JsonMsg=JSON.serialize(reqst);
|
|
Test.startTest();
|
|
RestRequest req = new RestRequest();
|
|
RestResponse res = new RestResponse();
|
|
req.requestURI = '/services/apexrest/DemoUrl'; //Request URL
|
|
req.httpMethod = 'POST';//HTTP Request Type
|
|
req.requestBody = Blob.valueof(JsonMsg);
|
|
RestContext.request = req;
|
|
RestContext.response= res;
|
|
DeleteCollectionFromShopify.deleteCollection();
|
|
|
|
Restrequest authenticationReq = new Restrequest();
|
|
authenticationReq.requestBody = Blob.valueOf('{ "HIC_ShopifySync__Refresh_Token__c" : "hgfghjhkfdsgfhgjkhdfssgffh" }');
|
|
Restresponse authenticationRes = new Restresponse();
|
|
authenticationReq.requestURI = 'https://hic-sf-shopify-developer-edition.ap15.force.com/services/apexrest/HIC_ShopifySync/AuthenticateAllApexClass?objectname=DraftOrder&DMLType=Update';
|
|
authenticationReq.httpMethod = 'POST';
|
|
authenticationReq.addParameter('objectname', 'Customer');
|
|
authenticationReq.addParameter('DMLType', 'Update');
|
|
|
|
RestContext.request = authenticationReq;
|
|
RestContext.response= authenticationRes ;
|
|
authenticationRes.statusCode = 200;
|
|
UpdateRefreshToken.updatetoken();
|
|
//AuthenticateAllapexClass.AuthenticateClass();
|
|
system.assertEquals(200, authenticationRes.statusCode);
|
|
Test.stopTest();
|
|
}
|
|
|
|
|
|
|
|
} |