Changeset 1927 for branches/release-35/t/22-author.t
- Timestamp:
- 04/16/08 15:36:30 (20 months ago)
- Files:
-
- 1 modified
-
branches/release-35/t/22-author.t (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-35/t/22-author.t
r1100 r1927 8 8 use lib 'extlib'; 9 9 10 use Test::More tests => 54;10 use Test::More tests => 64; 11 11 12 12 use MT; … … 34 34 my $perm = $author->blog_perm(1); 35 35 ok($perm, "$author->blog_perm(1)") || die; 36 ok($author->can_edit_entry(1), ' can_edit_entry(1)');37 ok($author->can_edit_entry(2), ' can_edit_entry(2)');36 ok($author->can_edit_entry(1), 'Chuck D can edit entry #1'); 37 ok($author->can_edit_entry(2), 'Chuck D can edit entry #2'); 38 38 ok($perm->can_comment, 'can_comment'); 39 39 ok($perm->can_post, 'can_post'); … … 58 58 59 59 { 60 diag('meta field tests'); 61 62 my $author = MT::Author->load({ name => 'Chuck D' }); 63 ok(eval { $author->widgets(); 1 }, 'Author obj has widgets accessor'); 64 ok(!defined $author->widgets, "Author's widgets are undefined by default"); 65 ok(!defined $author->favorite_blogs, "Author's favorite blogs are undefined by default"); 66 67 # same as in MT::CMS::Dashboard, but that's not necessary 68 my $default_widgets = { 69 'blog_stats' => 70 { param => { tab => 'entry' }, order => 1, set => 'main' }, 71 'this_is_you-1' => { order => 1, set => 'sidebar' }, 72 'mt_shortcuts' => { order => 2, set => 'sidebar' }, 73 'mt_news' => { order => 3, set => 'sidebar' }, 74 }; 75 76 my $fav_blogs = [1, 7]; # not actually a blog #7, but meh 77 78 ok($author->widgets($default_widgets), "Author's widgets can be set"); 79 ok($author->favorite_blogs($fav_blogs), "Author's favorite blogs can be set"); 80 ok($author->save(), "Author with modified widgets can be saved"); 81 82 require MT::ObjectDriver::Driver::Cache::RAM; 83 MT::ObjectDriver::Driver::Cache::RAM->clear_cache(); 84 85 $author = MT::Author->load({ name => 'Chuck D' }); 86 87 ok($author->widgets, "Modified author has widgets"); 88 is_deeply($author->widgets, $default_widgets, "Author's widgets survived being saved accurately"); 89 90 ok($author->favorite_blogs, "Modified author has favorite blogs"); 91 is_deeply($author->favorite_blogs, $fav_blogs, "Author's favorite blogs survived being saved accurately"); 92 } 93 94 { 60 95 my $author = MT::Author->load({ name => 'Bob D' }); 61 96 $author = MT::Author->load($author->id); # silly ruse to force caching.... … … 68 103 ok( ! $author->can_view_log, 'can_view_log' ); 69 104 ok( ! $author->can_manage_plugins, 'can manage plugins'); 70 ok( ! $author->can_edit_entry(1), ' can_edit_entry(1)' );71 ok( $author->can_edit_entry(2), ' can_edit_entry(2)' );105 ok( ! $author->can_edit_entry(1), 'Bob D can edit entry #1' ); 106 ok( $author->can_edit_entry(2), 'Bob D can edit entry #2' ); 72 107 ok( $perm->can_post, 'can_post' ); 73 108 ok( $perm->can_create_post, 'can_create_post'); 74 109 ok( $perm->can_publish_post, 'can_publish_post'); 75 ok( ! $perm->can_upload, 'can_upload' );76 ok( ! $perm->can_edit_all_posts, ' can_edit_all_posts' );110 ok( $perm->can_upload, 'Bob D can *not* upload files' ); 111 ok( ! $perm->can_edit_all_posts, 'Bob D can *not* edit all posts' ); 77 112 ok( ! $perm->can_manage_pages, 'can_manage_pages'); 78 ok( $perm->can_edit_templates, 'can_edit_templates' );113 ok( ! $perm->can_edit_templates, 'Bob D can *not* edit templates' ); 79 114 ok( ! $perm->can_edit_tags, 'can_edit_tags'); 80 115 ok( ! $perm->can_edit_config, 'can_edit_config' ); 81 116 ok( ! $perm->can_set_publish_paths, 'can_set_publish_paths'); 82 117 ok( ! $perm->can_rebuild, 'can_rebuild' ); 83 ok( ! $perm->can_send_notifications, 'can_send_notifications' );118 ok( $perm->can_send_notifications, 'Bob D can send notifications' ); 84 119 ok( ! $perm->can_edit_categories, 'can_edit_categories' ); 85 120 ok( ! $perm->can_edit_notifications, 'can_edit_notifications' );
