Guest User

Untitled

a guest
Feb 12th, 2018
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. @isTest
  2. public class S360_LightningLoginFormController_Test {
  3. public static testmethod void testLoginForm(){
  4. //create User
  5. User u = new User(
  6. ProfileId = [SELECT Id FROM Profile WHERE Name ='Business System Administrator'].Id,
  7. LastName = 'last',
  8. Email = 'test@force.com',
  9. Username = 'test@force.com' + System.currentTimeMillis(),
  10. CompanyName = 'TEST',
  11. Title = 'title',
  12. Alias = 'alias',
  13. TimeZoneSidKey = 'America/Los_Angeles',
  14. EmailEncodingKey = 'UTF-8',
  15. LanguageLocaleKey ='fr',
  16. LocaleSidKey ='fr_CA');
  17. insert u;
  18.  
  19. SiteRegisterController controller = new SiteRegisterController();
  20. controller.username = 'test@force.com';
  21. controller.email = 'test@force.com';
  22. controller.communityNickname = 'test';
  23. // registerUser always returns null when the page isn't accessed as a guest user
  24. System.assert(controller.registerUser() == null);
  25. controller.password = 'abcd1234';
  26. controller.confirmPassword = 'abcd123';
  27. System.assert(controller.registerUser() == null);
  28. Site.createPortalUser(u,'abcd1234','');
  29.  
  30. S360_LightningLoginFormController.login(u.Username,'sunlife','url',true);
  31.  
  32. }
  33. public static testmethod void testLoginFormDetails(){
  34. //create User
  35. User u = new User(
  36. ProfileId = [SELECT Id FROM Profile WHERE Name ='Business System Administrator'].Id,
  37. LastName = 'last',
  38. Email = 'test@gmail.com',
  39. Username = 'test1@gmail.com' + System.currentTimeMillis(),
  40. CompanyName = 'TEST',
  41. Title = 'title',
  42. Alias = 'alias',
  43. TimeZoneSidKey = 'America/Los_Angeles',
  44. EmailEncodingKey = 'UTF-8',
  45. LanguageLocaleKey = 'fr',
  46. LocaleSidKey = 'fr_CA');
  47. S360_LightningLoginFormController.login(u.Username,'sunlife','url',true);
  48.  
  49. }
Add Comment
Please, Sign In to add comment