314 lines
23 KiB
OpenEdge ABL
314 lines
23 KiB
OpenEdge ABL
@isTest
|
|
public class AuthenticateInternally_Test {
|
|
|
|
@isTest
|
|
public static void Method() {
|
|
|
|
|
|
List<HIC_ShopifySync__Configuration__c> recordList = New List<HIC_ShopifySync__Configuration__c>();
|
|
|
|
HIC_ShopifySync__Configuration__c confi = new HIC_ShopifySync__Configuration__c();
|
|
confi.Name='Default';
|
|
confi.HIC_ShopifySync__ClientSecret__c = 'test';
|
|
confi.HIC_ShopifySync__ClientId__c = 'test123';
|
|
system.assertEquals('Default', confi.name);
|
|
recordList.add(confi);
|
|
insert confi;
|
|
|
|
HIC_ShopifySync__Internal_Callout__c hicSyncInt = new HIC_ShopifySync__Internal_Callout__c();
|
|
hicSyncInt.Name = 'demo';
|
|
hicSyncInt.HIC_ShopifySync__Client_Id__c = 'test';
|
|
hicSyncInt.HIC_ShopifySync__Client_Secret__c = 'test1';
|
|
hicSyncInt.HIC_ShopifySync__Password__c = '1234';
|
|
hicSyncInt.HIC_ShopifySync__Salesforce_Url__c = 'https://www.google.com';
|
|
hicSyncInt.HIC_ShopifySync__UserName__c = '12345';
|
|
insert hicSyncInt;
|
|
|
|
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": null, "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": null, "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'; //Request URL
|
|
req.httpMethod = 'POST';
|
|
RestContext.request = req;
|
|
RestContext.response= res;
|
|
|
|
Test.startTest();
|
|
|
|
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
|
|
AuthenticateInternally AutIn = new AuthenticateInternally();
|
|
AutIn.authenticateInternallyController();
|
|
|
|
PageReference pageRef = Page.ThankYouPageSuccessfulAuthentication; // Add your VF page Name here
|
|
pageRef.getParameters().put('id', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('code', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('state', String.valueOf(confi.Id));
|
|
|
|
//PageReference pageRef = Page.ThankYouPageSuccessfulAuthentication; // Add your VF page Name here
|
|
pageRef.getParameters().put('id', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('code', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('state', String.valueOf(confi.Id));
|
|
|
|
Test.setCurrentPage(pageRef);
|
|
|
|
AuthenticateInternally.createService('test');
|
|
|
|
AuthenticateInternally.createRemoteSiteSettings('www.google.com','test');
|
|
|
|
AuthenticateInternally.oauthLogin('test', '123', '1234', 'test1', 'test123');
|
|
|
|
AuthenticateInternally dosu= new AuthenticateInternally();
|
|
|
|
dosu.dosubmit();
|
|
Test.stopTest();
|
|
}
|
|
|
|
@isTest
|
|
public static void Test1() {
|
|
|
|
|
|
List<HIC_ShopifySync__Configuration__c> recordList = New List<HIC_ShopifySync__Configuration__c>();
|
|
|
|
HIC_ShopifySync__Configuration__c confi = new HIC_ShopifySync__Configuration__c();
|
|
confi.Name='Default';
|
|
confi.HIC_ShopifySync__ClientSecret__c = 'test';
|
|
confi.HIC_ShopifySync__ClientId__c = 'test123';
|
|
system.assertEquals('Default', confi.name);
|
|
recordList.add(confi);
|
|
insert confi;
|
|
|
|
HIC_ShopifySync__Internal_Callout__c hicSyncInt = new HIC_ShopifySync__Internal_Callout__c();
|
|
hicSyncInt.Name = 'demo';
|
|
hicSyncInt.HIC_ShopifySync__Client_Id__c = 'test';
|
|
hicSyncInt.HIC_ShopifySync__Client_Secret__c = 'test1';
|
|
hicSyncInt.HIC_ShopifySync__Password__c = '1234';
|
|
hicSyncInt.HIC_ShopifySync__Salesforce_Url__c = 'https://www.google.com';
|
|
hicSyncInt.HIC_ShopifySync__UserName__c = '12345';
|
|
insert hicSyncInt;
|
|
|
|
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": null, "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": null, "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'; //Request URL
|
|
req.httpMethod = 'POST';
|
|
RestContext.request = req;
|
|
RestContext.response= res;
|
|
|
|
Test.startTest();
|
|
|
|
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
|
|
AuthenticateInternally AutIn = new AuthenticateInternally();
|
|
AutIn.authenticateInternallyController();
|
|
AutIn.dosubmit();
|
|
|
|
PageReference pageRef = Page.ThankYouPageSuccessfulAuthentication; // Add your VF page Name here
|
|
pageRef.getParameters().put('id', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('code', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('state', String.valueOf(confi.Id));
|
|
|
|
//PageReference pageRef = Page.ThankYouPageSuccessfulAuthentication; // Add your VF page Name here
|
|
pageRef.getParameters().put('viewmode', 'Theme3');
|
|
pageRef.getParameters().put('customerInstanceUrl', 'ww.google.com');
|
|
//pageRef.getParameters().put('state', String.valueOf(confi.Id));
|
|
|
|
Test.setCurrentPage(pageRef);
|
|
|
|
AuthenticateInternally.createService('test');
|
|
|
|
AuthenticateInternally.createRemoteSiteSettings('www.google.com','test');
|
|
|
|
AuthenticateInternally.oauthLogin('test', '123', '1234', 'test1', 'test123');
|
|
|
|
AuthenticateInternally dosu= new AuthenticateInternally();
|
|
dosu.inProgress =true;
|
|
dosu.error = true;
|
|
|
|
AuthenticateInternally.readToken r =new AuthenticateInternally.readToken();
|
|
r.access_token='hjjhgs';
|
|
r.instance_url='jgjycgj';
|
|
|
|
|
|
dosu.dosubmit();
|
|
Test.stopTest();
|
|
}
|
|
|
|
|
|
@isTest
|
|
public static void Test2() {
|
|
|
|
|
|
List<HIC_ShopifySync__Configuration__c> recordList = New List<HIC_ShopifySync__Configuration__c>();
|
|
|
|
HIC_ShopifySync__Configuration__c confi = new HIC_ShopifySync__Configuration__c();
|
|
confi.Name='Default';
|
|
confi.HIC_ShopifySync__ClientSecret__c = 'test';
|
|
confi.HIC_ShopifySync__ClientId__c = 'test123';
|
|
system.assertEquals('Default', confi.name);
|
|
recordList.add(confi);
|
|
insert confi;
|
|
|
|
HIC_ShopifySync__Internal_Callout__c hicSyncInt = new HIC_ShopifySync__Internal_Callout__c();
|
|
hicSyncInt.Name = 'demo';
|
|
hicSyncInt.HIC_ShopifySync__Client_Id__c = 'test';
|
|
hicSyncInt.HIC_ShopifySync__Client_Secret__c = 'test1';
|
|
hicSyncInt.HIC_ShopifySync__Password__c = '1234';
|
|
hicSyncInt.HIC_ShopifySync__Salesforce_Url__c = 'https://www.google.com';
|
|
hicSyncInt.HIC_ShopifySync__UserName__c = '12345';
|
|
insert hicSyncInt;
|
|
|
|
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": null, "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": null, "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'; //Request URL
|
|
req.httpMethod = 'POST';
|
|
RestContext.request = req;
|
|
RestContext.response= res;
|
|
|
|
Test.startTest();
|
|
|
|
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
|
|
AuthenticateInternally AutIn = new AuthenticateInternally();
|
|
AutIn.authenticateInternallyController();
|
|
AutIn.dosubmit();
|
|
|
|
PageReference pageRef = Page.ThankYouPageSuccessfulAuthentication; // Add your VF page Name here
|
|
pageRef.getParameters().put('id', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('code', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('state', String.valueOf(confi.Id));
|
|
|
|
//PageReference pageRef = Page.ThankYouPageSuccessfulAuthentication; // Add your VF page Name here
|
|
pageRef.getParameters().put('viewmode', 'Theme4d');
|
|
pageRef.getParameters().put('customerInstanceUrl', 'ww.google.com');
|
|
//pageRef.getParameters().put('login_hint', 'test');
|
|
|
|
Test.setCurrentPage(pageRef);
|
|
|
|
AuthenticateInternally.createService('test');
|
|
|
|
AuthenticateInternally.createRemoteSiteSettings('www.google.com','test');
|
|
|
|
AuthenticateInternally.oauthLogin('test', '123', '1234', 'test1', 'test123');
|
|
|
|
AuthenticateInternally dosu= new AuthenticateInternally();
|
|
dosu.inProgress =true;
|
|
dosu.error = true;
|
|
|
|
AuthenticateInternally.readToken r =new AuthenticateInternally.readToken();
|
|
r.access_token='hjjhgs';
|
|
r.instance_url='jgjycgj';
|
|
|
|
|
|
dosu.dosubmit();
|
|
Test.stopTest();
|
|
}
|
|
@isTest
|
|
public static void Test3() {
|
|
|
|
|
|
List<HIC_ShopifySync__Configuration__c> recordList = New List<HIC_ShopifySync__Configuration__c>();
|
|
|
|
HIC_ShopifySync__Configuration__c confi = new HIC_ShopifySync__Configuration__c();
|
|
confi.Name='Default';
|
|
confi.HIC_ShopifySync__ClientSecret__c = 'test';
|
|
confi.HIC_ShopifySync__ClientId__c = 'test123';
|
|
system.assertEquals('Default', confi.name);
|
|
recordList.add(confi);
|
|
insert confi;
|
|
|
|
HIC_ShopifySync__Internal_Callout__c hicSyncInt = new HIC_ShopifySync__Internal_Callout__c();
|
|
hicSyncInt.Name = 'demo';
|
|
hicSyncInt.HIC_ShopifySync__Client_Id__c = 'test';
|
|
hicSyncInt.HIC_ShopifySync__Client_Secret__c = 'test1';
|
|
hicSyncInt.HIC_ShopifySync__Password__c = '1234';
|
|
hicSyncInt.HIC_ShopifySync__Salesforce_Url__c = 'https://www.google.com';
|
|
hicSyncInt.HIC_ShopifySync__UserName__c = '12345';
|
|
insert hicSyncInt;
|
|
|
|
RestRequest req = New RestRequest();
|
|
RestResponse res = New RestResponse();
|
|
req.requestBody = Blob.valueof('[{"duties":[],"refund_line_items":[{"line_item":{"discount_allocations":[],"duties":[],"tax_lines":[{"title":"CGST","rate":0.09,"price_set":{"presentment_money":{"currency_code":"INR","amount":"63.00"},"shop_money":{"currency_code":"INR","amount":"63.00"}},"price":"63.00","channel_liable":false}],"vendor":"Snowboard Vendor","variant_title":"Dawn","variant_inventory_management":"shopify","variant_id":45157856903470,"total_discount_set":{"presentment_money":{"currency_code":"INR","amount":"0.00"},"shop_money":{"currency_code":"INR","amount":"0.00"}},"total_discount":"0.00","title":"The Complete Snowboard","taxable":true,"sku":"","requires_shipping":true,"quantity":1,"properties":[],"product_id":8283640561966,"product_exists":true,"price_set":{"presentment_money":{"currency_code":"INR","amount":"699.95"},"shop_money":{"currency_code":"INR","amount":"699.95"}},"price":"699.95","name":"The Complete Snowboard - Dawn","grams":4536,"gift_card":false,"fulfillment_status":null,"fulfillment_service":"manual","fulfillable_quantity":0,"admin_graphql_api_id":"gid://shopify/LineItem/13837641089326","id":13837641089326},"total_tax_set":{"presentment_money":{"currency_code":"INR","amount":"63.00"},"shop_money":{"currency_code":"INR","amount":"63.00"}},"total_tax":63.0,"subtotal_set":{"presentment_money":{"currency_code":"INR","amount":"699.95"},"shop_money":{"currency_code":"INR","amount":"699.95"}},"subtotal":699.95,"restock_type":"cancel","quantity":1,"location_id":82547802414,"line_item_id":13837641089326,"id":554294444334},{"line_item":{"discount_allocations":[],"duties":[],"tax_lines":[{"title":"CGST","rate":0.09,"price_set":{"presentment_money":{"currency_code":"INR","amount":"63.00"},"shop_money":{"currency_code":"INR","amount":"63.00"}},"price":"63.00","channel_liable":false}],"vendor":"Snowboard Vendor","variant_title":"Powder","variant_inventory_management":"shopify","variant_id":45157856936238,"total_discount_set":{"presentment_money":{"currency_code":"INR","amount":"0.00"},"shop_money":{"currency_code":"INR","amount":"0.00"}},"total_discount":"0.00","title":"The Complete Snowboard","taxable":true,"sku":"","requires_shipping":true,"quantity":1,"properties":[],"product_id":8283640561966,"product_exists":true,"price_set":{"presentment_money":{"currency_code":"INR","amount":"699.95"},"shop_money":{"currency_code":"INR","amount":"699.95"}},"price":"699.95","name":"The Complete Snowboard - Powder","grams":4536,"gift_card":false,"fulfillment_status":null,"fulfillment_service":"manual","fulfillable_quantity":0,"admin_graphql_api_id":"gid://shopify/LineItem/13837641122094","id":13837641122094},"total_tax_set":{"presentment_money":{"currency_code":"INR","amount":"63.00"},"shop_money":{"currency_code":"INR","amount":"63.00"}},"total_tax":63.0,"subtotal_set":{"presentment_money":{"currency_code":"INR","amount":"699.95"},"shop_money":{"currency_code":"INR","amount":"699.95"}},"subtotal":699.95,"restock_type":"cancel","quantity":1,"location_id":82547802414,"line_item_id":13837641122094,"id":554294477102}],"transactions":[{"user_id":96347291950,"test":false,"status":"success","source_name":"1830279","receipt":{},"processed_at":"2023-05-09T04:24:24-04:00","payment_id":"#1050.2","parent_id":6503484621102,"order_id":5320796406062,"message":"Refunded 1525.90 from manual gateway","location_id":null,"kind":"refund","gateway":"manual","error_code":null,"device_id":null,"currency":"INR","created_at":"2023-05-09T04:24:24-04:00","authorization":null,"amount":"1525.90","admin_graphql_api_id":"gid://shopify/OrderTransaction/6503484850478","id":6503484850478}],"order_adjustments":[],"user_id":96347291950,"total_duties_set":{"presentment_money":{"currency_code":"INR","amount":"0.00"},"shop_money":{"currency_code":"INR","amount":"0.00"}},"restock":true,"processed_at":"2023-05-09T04:24:24-04:00","order_id":5320796406062,"note":"","created_at":"2023-05-09T04:24:24-04:00","admin_graphql_api_id":"gid://shopify/Refund/943358017838","id":943358017838},{"duties":[],"refund_line_items":[{"line_item":{"discount_allocations":[],"duties":[],"tax_lines":[{"title":"CGST","rate":0.09,"price_set":{"presentment_money":{"currency_code":"INR","amount":"62.99"},"shop_money":{"currency_code":"INR","amount":"62.99"}},"price":"62.99","channel_liable":false}],"vendor":"Snowboard Vendor","variant_title":"Ice","variant_inventory_management":"shopify","variant_id":45157856870702,"total_discount_set":{"presentment_money":{"currency_code":"INR","amount":"0.00"},"shop_money":{"currency_code":"INR","amount":"0.00"}},"total_discount":"0.00","title":"The Complete Snowboard","taxable":true,"sku":"","requires_shipping":true,"quantity":1,"properties":[],"product_id":8283640561966,"product_exists":true,"price_set":{"presentment_money":{"currency_code":"INR","amount":"699.95"},"shop_money":{"currency_code":"INR","amount":"699.95"}},"price":"699.95","name":"The Complete Snowboard - Ice","grams":4536,"gift_card":false,"fulfillment_status":null,"fulfillment_service":"manual","fulfillable_quantity":0,"admin_graphql_api_id":"gid://shopify/LineItem/13837641056558","id":13837641056558},"total_tax_set":{"presentment_money":{"currency_code":"INR","amount":"62.99"},"shop_money":{"currency_code":"INR","amount":"62.99"}},"total_tax":62.99,"subtotal_set":{"presentment_money":{"currency_code":"INR","amount":"699.95"},"shop_money":{"currency_code":"INR","amount":"699.95"}},"subtotal":699.95,"restock_type":"cancel","quantity":1,"location_id":82547802414,"line_item_id":13837641056558,"id":554407362862}],"transactions":[{"user_id":96347291950,"test":false,"status":"success","source_name":"1830279","receipt":{},"processed_at":"2023-05-12T02:50:50-04:00","payment_id":"#1050.3","parent_id":6503484621102,"order_id":5320796406062,"message":"Refunded 762.94 from manual gateway","location_id":null,"kind":"refund","gateway":"manual","error_code":null,"device_id":null,"currency":"INR","created_at":"2023-05-12T02:50:50-04:00","authorization":null,"amount":"762.94","admin_graphql_api_id":"gid://shopify/OrderTransaction/6505704816942","id":6505704816942}],"order_adjustments":[],"user_id":96347291950,"total_duties_set":{"presentment_money":{"currency_code":"INR","amount":"0.00"},"shop_money":{"currency_code":"INR","amount":"0.00"}},"restock":true,"processed_at":"2023-05-12T02:50:50-04:00","order_id":5320796406062,"note":"","created_at":"2023-05-12T02:50:50-04:00","admin_graphql_api_id":"gid://shopify/Refund/943454060846","id":943454060846}]]}');
|
|
req.requestURI = 'https://hic-sf-shopify-developer-edition.ap15.force.com'; //Request URL
|
|
req.httpMethod = 'POST';
|
|
RestContext.request = req;
|
|
RestContext.response= res;
|
|
|
|
Test.startTest();
|
|
|
|
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
|
|
AuthenticateInternally AutIn = new AuthenticateInternally();
|
|
AutIn.authenticateInternallyController();
|
|
AutIn.dosubmit();
|
|
|
|
PageReference pageRef = Page.ThankYouPageSuccessfulAuthentication; // Add your VF page Name here
|
|
pageRef.getParameters().put('id', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('code', String.valueOf(confi.Id));
|
|
pageRef.getParameters().put('state', String.valueOf(confi.Id));
|
|
|
|
//PageReference pageRef = Page.ThankYouPageSuccessfulAuthentication; // Add your VF page Name here
|
|
pageRef.getParameters().put('viewmode', 'Theme4d');
|
|
pageRef.getParameters().put('customerInstanceUrl', 'ww.google.com');
|
|
//pageRef.getParameters().put('login_hint', 'test');
|
|
|
|
Test.setCurrentPage(pageRef);
|
|
|
|
AuthenticateInternally.createService('test');
|
|
|
|
|
|
AuthenticateInternally.createRemoteSiteSettings('www.google.com','test');
|
|
|
|
AuthenticateInternally.oauthLogin('test', '123', '1234', 'test1', 'test123');
|
|
|
|
AuthenticateInternally dosu= new AuthenticateInternally();
|
|
dosu.inProgress =true;
|
|
dosu.error = False;
|
|
|
|
AuthenticateInternally.readToken r =new AuthenticateInternally.readToken();
|
|
r.access_token='hjjhgs';
|
|
r.instance_url='jgjycgj';
|
|
|
|
|
|
dosu.dosubmit();
|
|
Test.stopTest();
|
|
}
|
|
|
|
@isTest
|
|
static void test_authenticateInternallyController() {
|
|
// Setup mock Configuration record
|
|
HIC_ShopifySync__Configuration__c config = new HIC_ShopifySync__Configuration__c(
|
|
Name = 'Default',
|
|
HIC_ShopifySync__ClientId__c = 'testClientId',
|
|
HIC_ShopifySync__ClientSecret__c = 'testClientSecret'
|
|
);
|
|
insert config;
|
|
|
|
// Setup mock Internal_Callout record
|
|
HIC_ShopifySync__Internal_Callout__c internalCallout = new HIC_ShopifySync__Internal_Callout__c(
|
|
Name = 'Default',
|
|
HIC_ShopifySync__Client_Id__c = 'clientId',
|
|
HIC_ShopifySync__Client_Secret__c = 'clientSecret',
|
|
HIC_ShopifySync__Password__c = 'password',
|
|
HIC_ShopifySync__Salesforce_Url__c = 'https://login.salesforce.com',
|
|
HIC_ShopifySync__UserName__c = 'username'
|
|
);
|
|
insert internalCallout;
|
|
|
|
// Mock page context (✅ no real VF page needed)
|
|
Test.setCurrentPage(new PageReference('https://hicshopifymadeeasy-dev-ed.my.salesforce-sites.com/thankYouPageSuccessfulAuthentication'));
|
|
|
|
// Add parameters that your controller expects
|
|
ApexPages.currentPage().getParameters().put('code', '12345');
|
|
ApexPages.currentPage().getParameters().put('state', 'returnUrlTheme3');
|
|
ApexPages.currentPage().getParameters().put('login_hint', 'testUser');
|
|
|
|
// Instantiate your controller
|
|
AuthenticateInternally controller = new AuthenticateInternally();
|
|
|
|
// Call the method
|
|
Test.startTest();
|
|
PageReference result = controller.authenticateInternallyController();
|
|
Test.stopTest();
|
|
|
|
// Validate behavior
|
|
System.assertEquals(null, result, 'Should return null during test context since callouts are skipped');
|
|
}
|
|
|
|
} |