Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @isTest
- public class S360_LightningLoginFormController_Test {
- public static testmethod void testLoginForm(){
- //create User
- User u = new User(
- ProfileId = [SELECT Id FROM Profile WHERE Name ='Business System Administrator'].Id,
- LastName = 'last',
- Email = 'test@force.com',
- Username = 'test@force.com' + System.currentTimeMillis(),
- CompanyName = 'TEST',
- Title = 'title',
- Alias = 'alias',
- TimeZoneSidKey = 'America/Los_Angeles',
- EmailEncodingKey = 'UTF-8',
- LanguageLocaleKey ='fr',
- LocaleSidKey ='fr_CA');
- insert u;
- SiteRegisterController controller = new SiteRegisterController();
- controller.username = 'test@force.com';
- controller.email = 'test@force.com';
- controller.communityNickname = 'test';
- // registerUser always returns null when the page isn't accessed as a guest user
- System.assert(controller.registerUser() == null);
- controller.password = 'abcd1234';
- controller.confirmPassword = 'abcd123';
- System.assert(controller.registerUser() == null);
- Site.createPortalUser(u,'abcd1234','');
- S360_LightningLoginFormController.login(u.Username,'sunlife','url',true);
- }
- public static testmethod void testLoginFormDetails(){
- //create User
- User u = new User(
- ProfileId = [SELECT Id FROM Profile WHERE Name ='Business System Administrator'].Id,
- LastName = 'last',
- Email = 'test@gmail.com',
- Username = 'test1@gmail.com' + System.currentTimeMillis(),
- CompanyName = 'TEST',
- Title = 'title',
- Alias = 'alias',
- TimeZoneSidKey = 'America/Los_Angeles',
- EmailEncodingKey = 'UTF-8',
- LanguageLocaleKey = 'fr',
- LocaleSidKey = 'fr_CA');
- S360_LightningLoginFormController.login(u.Username,'sunlife','url',true);
- }
Add Comment
Please, Sign In to add comment