56 lines
3.4 KiB
OpenEdge ABL
56 lines
3.4 KiB
OpenEdge ABL
@isTest
|
|
public class CheckAccessibility_Test {
|
|
|
|
public static testMethod void testMethod1(){
|
|
|
|
CheckAccessibility.isAccessible('FirstName, LastName','contact');
|
|
CheckAccessibility.isInsertable('FirstName,LastName,RecordType.DeveloperName, RecordTypeId' ,'contact');
|
|
|
|
DescribeSObjectResult getSchemaType = Schema.getGlobalDescribe().get('contact').getDescribe();
|
|
CheckAccessibility.isAccessible('FirstName,LastName,RecordType.DeveloperName, RecordTypeId',getSchemaType);
|
|
|
|
CheckAccessibility.isUpdateable('FirstName, LastName' ,'contact');
|
|
Boolean deletebaleContactPermission = CheckAccessibility.isDeletable('contact');
|
|
Boolean upsertableContactPermission = CheckAccessibility.isUpsertable('FirstName, LastName' ,'contact');
|
|
|
|
system.assertEquals(true, deletebaleContactPermission);
|
|
system.assertEquals(true, upsertableContactPermission);
|
|
|
|
|
|
|
|
}
|
|
@isTest
|
|
static void CheckAccessibility_Test1(){
|
|
|
|
CustomSettingRecordInsert postinstall = new CustomSettingRecordInsert();
|
|
Test.testInstall(postinstall, null);
|
|
Test.testInstall(postinstall, new Version(1,0), true);
|
|
|
|
HIC_ShopifySync__Configuration__c configration = new HIC_ShopifySync__Configuration__c();
|
|
|
|
configration.name = 'HIC_ShopifySync__Configuration__c';
|
|
configration.Refresh_Token__c = 'Test' ;
|
|
insert configration;
|
|
|
|
|
|
Account acc = new Account(name='DeleteCustomerFromShopify_Test');
|
|
acc.HIC_ShopifySync__Shopify_id__c = 'Business 1073387929664';
|
|
insert acc;
|
|
|
|
RestRequest req = new RestRequest();
|
|
RestResponse res = new RestResponse();
|
|
|
|
req.requestBody = Blob.valueof('{ "id": 1073387929664, "email": null, "accepts_marketing": false, "created_at": "2019-01-10T00:12:13-12:00", "updated_at": "2019-01-10T00:12:13-12:00", "first_name": "uv", "last_name": "uv", "orders_count": 0, "state": "disabled", "total_spent": "0.00", "last_order_id": null, "note": "", "verified_email": true, "multipass_identifier": null, "tax_exempt": false, "phone": null, "tags": "", "last_order_name": null, "currency": "INR", "addresses": [ { "id": 1197969899584, "customer_id": 1073387929664, "first_name": "firstnameu", "last_name": "lastnamev", "company": "company", "address1": "address", "address2": "", "city": "", "province": "", "country": "India", "zip": "", "phone": "", "name": "firstnameu lastnamev", "province_code": null, "country_code": "IN", "country_name": "India", "default": true } ], "admin_graphql_api_id": "gid://shopify/Customer/1073387929664", "default_address": { "id": 1197969899584, "customer_id": 1073387929664, "first_name": "firstnameu", "last_name": "lastnamev", "company": "company", "address1": "address", "address2": "", "city": "", "province": "", "country": "India", "zip": "", "phone": "", "name": "firstnameu lastnamev", "province_code": null, "country_code": "IN", "country_name": "India", "default": true } }');
|
|
req.requestURI = 'https://hic-sf-shopify-developer-edition.ap15.force.com/services/apexrest/DeleteCustomerFromShopify'; //Request URL
|
|
req.httpMethod = 'POST';
|
|
|
|
RestContext.request = req;
|
|
RestContext.response= res;
|
|
res.statuscode = 200;
|
|
Test.startTest();
|
|
DeleteCustomerFromShopify.DeleteCustomer();
|
|
Test.stopTest();
|
|
system.assertequals(200, res.statuscode);
|
|
}
|
|
|
|
} |