re-work installation to use a bse.cfg style file
[bse.git] / t / 070-user / 010-edit.t
CommitLineData
3bc94f98
TC
1#!perl -w
2use strict;
5bbf7309
TC
3use Test::More tests => 22;
4use BSE::Test qw(base_url make_ua check_form post_ok
f559e1b9
TC
5 check_content follow_ok);
6use URI::QueryParam;
aefcabcb 7#use WWW::Mechanize;
3bc94f98 8++$|;
3bc94f98
TC
9my $baseurl = base_url;
10my $ua = make_ua;
3bc94f98 11
7063727a
TC
12ok($ua->get("$baseurl/cgi-bin/admin/add.pl?parentid=-1"), "edit page");
13 check_content($ua->{content}, 'edit page',
14 qr!No\s+parent\s+-\s+this\s+is\s+a\s+section
15 .*
16 common/default.tmpl
17 .*
918735d1 18 Add\s+New\s+Page\s+Lev1
7063727a
TC
19 !xs);
20check_form($ua->{content},
21 "edit form",
22 parentid=>[ -1, 'select' ],
23 id => [ '', 'hidden' ],
7063727a 24 template=> [ 'common/default.tmpl', 'select' ],
b9613fa5 25 body => [ '', 'textarea' ],
7063727a
TC
26 listed => [ 1, 'select' ],
27 );
28$ua->field(title=>'Test Article');
29$ua->field(body=>'This is a test body');
30ok($ua->click('save'), 'submit modified edit form');
70789617 31# should redirect to admin mode page
7063727a
TC
32check_content($ua->{content}, "admin mode",
33 qr!
0da5d199 34 <title>.*Test\ Article.*</title>
7063727a
TC
35 .*
36 This\ is\ a\ test\ body
37 !xsm);
f559e1b9
TC
38my $uri = $ua->uri;
39my $id = $uri->query_param("id");
40# manage sections
41ok($ua->get("$baseurl/cgi-bin/admin/add.pl?id=-1"), "sections page");
42follow_ok($ua, "clean up",
43 {
44 text => "Delete",
45 url_regex => qr/id=$id/
46 }, qr/Article deleted/);