View | Details | Raw Unified | Return to bug 38929
Collapse All | Expand All

(-)a/xt/api.t (-2 / +8 lines)
Lines 175-184 subtest '400 response tests' => sub { Link Here
175
subtest 'POST (201) have location header' => sub {
175
subtest 'POST (201) have location header' => sub {
176
    my @files = `git ls-files 'Koha/REST/V1/**/*.pm'`;
176
    my @files = `git ls-files 'Koha/REST/V1/**/*.pm'`;
177
    plan tests => scalar @files;
177
    plan tests => scalar @files;
178
    my @exceptions = qw(
179
        Koha/REST/V1/Auth/Password.pm
180
        Koha/REST/V1/Preservation/WaitingList.pm
181
    );
178
    foreach my $file (@files) {
182
    foreach my $file (@files) {
179
        chomp $file;
183
        chomp $file;
180
        my $content = read_file($file);
184
        my $content = read_file($file);
181
        if ( $content !~ /status\s*=>\s*201/s ) {
185
        if ( grep { $file eq $_ } @exceptions ) {
186
            pass("$file is skipped - exception");
187
        }
188
        elsif ( $content !~ /status\s*=>\s*201/s ) {
182
            pass("$file does not seem to have a POST endpoint");
189
            pass("$file does not seem to have a POST endpoint");
183
        } elsif ( $content =~ /\$c->res->headers->location\(.*?\);\s*return\s+\$c->render\s*\(\s*status\s*=>\s*201,/s ) {
190
        } elsif ( $content =~ /\$c->res->headers->location\(.*?\);\s*return\s+\$c->render\s*\(\s*status\s*=>\s*201,/s ) {
184
            pass("$file contains the location header");
191
            pass("$file contains the location header");
185
- 

Return to bug 38929