root/test/t/107_rest_perms.t

Revision 49b8645cf26c988d8416168333196b86d7a99204, 1.1 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 4 years ago)

filtersets are required

  • Property mode set to 100644
Line 
1 use Test::More tests => 3;
2 use XML::LibXML;
3 use XML::LibXML::XPathContext;
4 use testconfig;
5 use apiclient;
6
7 use strict;
8 my $xp = XML::LibXML->new();
9 my $xpc = XML::LibXML::XPathContext->new();
10
11 ok(start_noit("107", { logs_debug => { '' => 'false' },
12                        rest_acls => [
13                          { type => 'deny',
14                            rules => [
15                              { 'type' => 'allow', url => '^/checks/show/' },
16                            ]
17                          }
18                        ]
19                      }), 'starting noit');
20 sleep(1);
21 my $c = apiclient->new('localhost', $NOIT_API_PORT);
22 my @r = $c->get("/checks/show/f7cea020-f19d-11dd-85a6-cb6d3a2207dc");
23 is($r[0], 404, 'get checks');
24
25 @r = $c->put("/checks/set/f7cea020-f19d-11dd-85a6-cb6d3a2207dc",
26         qq{<?xml version="1.0" encoding="utf8"?>
27 <check><attributes><target>127.0.0.1</target><period>5000</period><timeout>1000</timeout><name>selfcheck</name><filterset>allowall</filerset><module>selfcheck</module></attributes><config/></check>});
28
29 is($r[0], 403, 'add selfcheck');
30
31 1;
Note: See TracBrowser for help on using the browser.