[Jifty-commit] r611 - in jifty/trunk: t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Feb 21 16:27:03 EST 2006


Author: alexmv
Date: Tue Feb 21 16:27:02 2006
New Revision: 611

Added:
   jifty/trunk/t/06-limit-actions.t
Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/MANIFEST

Log:
 r9219 at zoq-fot-pik:  chmrr | 2006-02-21 16:26:03 -0500
  * Update MANIFEST for removed images files
  * Add action limit tests pulled from other app


Modified: jifty/trunk/MANIFEST
==============================================================================
--- jifty/trunk/MANIFEST	(original)
+++ jifty/trunk/MANIFEST	Tue Feb 21 16:27:02 2006
@@ -111,10 +111,6 @@
 share/web/static/css/main.css
 share/web/static/css/nav.css
 share/web/static/favicon.ico
-share/web/static/images/atom.png
-share/web/static/images/ical.png
-share/web/static/images/pdf.png
-share/web/static/images/plaintext.png
 share/web/static/images/pony.jpg
 share/web/static/js/app_behaviour.js
 share/web/static/js/behaviour.js

Added: jifty/trunk/t/06-limit-actions.t
==============================================================================
--- (empty file)
+++ jifty/trunk/t/06-limit-actions.t	Tue Feb 21 16:27:02 2006
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+Tests that Jifty->web->(allow|deny)_actions work; this is to
+limit what users can do with temporary credentials (LetMes, etc)
+
+=cut
+
+use Jifty::Test tests => 12;
+
+use_ok('Jifty::Web');
+can_ok('Jifty::Web', 'setup_session');
+can_ok('Jifty::Web', 'session');
+
+my $web = Jifty::Web->new();
+$web->setup_session;
+
+ok($web->is_allowed("Foo"), "Tasks default to positive limit");
+
+$web->allow_actions ( qr'.*' );
+ok($web->is_allowed("Foo"), "Positive limit doesn't cause negative limit");
+
+$web->deny_actions ( qr'.*' );
+ok(!$web->is_allowed("Foo"), "Later negative limit overrides");
+ 
+$web->allow_actions ( qr'.*' );
+ok($web->is_allowed("Foo"), "Even later positive limit overrides again");
+
+$web->deny_actions  ( qr'Foo' );
+ok(!$web->is_allowed("Foo"), "Regex negative limit");
+ok(!$web->is_allowed("FooBar"), "Matches anywhere");
+ok(!$web->is_allowed("ILikeFood"), "Matches anywhere");
+ok($web->is_allowed("Bar"), "Doesn't impact other positive");
+
+$web->allow_actions  ( 'ILikeFood' );
+ok($web->is_allowed("ILikeFood"), "Positive string exact match");
+
+1;


More information about the Jifty-commit mailing list