auth-exceptions.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. (function () {
  2. 'use strict';
  3. var app = null;
  4. QUnit.acceptance("Auth Exceptions", {
  5. afterEach: function() {
  6. app.destroy();
  7. }
  8. });
  9. QUnit.test("denyAuthenticated denied authenticated", function(assert) {
  10. app = initTestMisago({
  11. user: mockUser()
  12. });
  13. var done = assert.async();
  14. app.router.route('/activation/');
  15. onElement('.page-error.page-error-403 .message-body', function() {
  16. assert.ok(true, "Permission denied error page was displayed.");
  17. assert.equal(
  18. getElementText('.page .message-body p:last-child'),
  19. "You have to be signed out to activate account.",
  20. "Route access was denied with valid error.");
  21. done();
  22. });
  23. });
  24. QUnit.test("denyAuthenticated passed anonymous", function(assert) {
  25. app = initTestMisago();
  26. var done = assert.async();
  27. app.router.route('/activation/');
  28. onElement('.page-request-activation', function() {
  29. assert.ok(true, "Access to route was granted for anonymous user.");
  30. done();
  31. });
  32. });
  33. }());