/src/test/kiwi/test/action/RegisterTest.java

https://github.com/StexX/KiWi-OSE · Java · 107 lines · 39 code · 16 blank · 52 comment · 0 complexity · bb49a72674cb3ac9731bcc97a21b2182 MD5 · raw file

  1. //$Id: RegisterTest.java 2396 2006-10-27 14:04:45Z gavin $
  2. package kiwi.test.action;
  3. import javax.faces.context.FacesContext;
  4. import kiwi.api.content.ContentItemService;
  5. import org.jboss.seam.Component;
  6. import org.jboss.seam.mock.SeamTest;
  7. import org.testng.annotations.Test;
  8. public class RegisterTest extends SeamTest
  9. {
  10. @Test
  11. public void testLogin() throws Exception
  12. {
  13. new FacesRequest() {
  14. @Override
  15. protected void processValidations() throws Exception
  16. {
  17. validateValue("#{kiwi.user.edit.login}", "1ovthafew");
  18. validateValue("#{kiwi.user.edit.firstName}", "Gavin King");
  19. validateValue("#{kiwi.user.edit.lastName}", "sadasda");
  20. validateValue("#{kiwi.user.edit.password}","secret");
  21. validateValue("#{kiwi.user.edit.email}","abc@gmx.at");
  22. assert !isValidationFailure();
  23. }
  24. @Override
  25. protected void updateModelValues() throws Exception
  26. {
  27. setValue("#{kiwi.user.edit.login}", "1ovthafew");
  28. setValue("#{kiwi.user.edit.firstName}", "Gavin King");
  29. setValue("#{kiwi.user.edit.lastName}", "sadasda");
  30. setValue("#{kiwi.user.edit.password}","secret");
  31. setValue("#{kiwi.user.edit.email}","abc@gmx.at");
  32. }
  33. @Override
  34. protected void invokeApplication()
  35. {
  36. invokeMethod("#{kiwi.action.createUser.createUser}");
  37. }
  38. }.run();
  39. // new NonFacesRequest("/registered.jspx")
  40. // {
  41. //
  42. // @Override
  43. // protected void renderResponse()
  44. // {
  45. // assert getValue("#{user.username}").equals("1ovthafew");
  46. // assert getValue("#{user.password}").equals("secret");
  47. // assert getValue("#{user.name}").equals("Gavin King");
  48. // }
  49. //
  50. // }.run();
  51. //
  52. // new FacesRequest("/register.jspx") {
  53. //
  54. // @Override
  55. // protected void processValidations() throws Exception
  56. // {
  57. // validateValue("#{user.username}", "1ovthafew");
  58. // validateValue("#{user.name}", "Gavin A King");
  59. // validateValue("#{user.password}", "password");
  60. // }
  61. //
  62. // @Override
  63. // protected void updateModelValues() throws Exception
  64. // {
  65. // setValue("#{user.username}", "1ovthafew");
  66. // setValue("#{user.name}", "Gavin A King");
  67. // setValue("#{user.password}", "password");
  68. // }
  69. //
  70. // @Override
  71. // protected void invokeApplication()
  72. // {
  73. // assert invokeMethod("#{register.register}")==null;
  74. // }
  75. //
  76. // @Override
  77. // protected void renderResponse() throws Exception
  78. // {
  79. // assert FacesContext.getCurrentInstance().getMessages().hasNext();
  80. // }
  81. //
  82. // @Override
  83. // protected void afterRequest()
  84. // {
  85. // assert isInvokeApplicationComplete();
  86. // assert isRenderResponseComplete();
  87. // }
  88. //
  89. // }.run();
  90. }
  91. }