# Copyright (c) 2009 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: Wiki4.bunit,v 1.5 2009/12/26 23:09:55 nagler Exp $ ShellUtil(); req()->set_realm_and_user('bunit_wiki', 'root'); model('RealmFile')->delete_all; my($original) = <<'EOF'; @h1 title @b-widget arg ^" EOF my($cases) = [map( { my($type, $path, $expect_change) = @$_; map(+{ path => model('RealmFile')->create_with_content( {path => b_use("Type.$type")->to_absolute($path, $_)}, \($original), )->get('path'), expect_change => $expect_change, }, 0 .. 1), } [FilePath => random_string(), 0], [WikiName => random_string(), 1], [BlogFileName => Type_DateTime()->now_as_file_name, 1], )]; my($update) = $original; $update =~ s/(?=arg)/value=/g; $update =~ s/\^(?=\&)/\@/g; [ [qw(-realm bunit_wiki upgrade_content)] => sub { foreach my $c (@$cases) { assert_equals( $c->{expect_change} ? $update : $original, model('RealmFile', {path => $c->{path}})->get_content, $c->{path}, ); } return 1; }, ];