File: workflows.t

package info (click to toggle)
libpithub-perl 0.01043-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,148 kB
  • sloc: perl: 9,098; makefile: 7
file content (40 lines) | stat: -rwxr-xr-x 1,164 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!perl

use strict;
use warnings;

use Pithub ();
use Test::More import => [qw( done_testing is ok skip subtest )];

# These tests may break very easily because data on Github can and will change, of course.
# And they also might fail once the ratelimit has been reached.
SKIP: {
    skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1
        unless $ENV{PITHUB_TEST_LIVE_DATA};

    my $p = Pithub->new;

    subtest 'list and get workflows' => sub {
        my $result = $p->repos->actions->workflows->list(
            user => 'Perl',
            repo => 'docker-perl-tester'
        );
        is(
            $result->success, 1,
            'Pithub::Repos::Actions::Workflows->branches successful'
        );
        ok( $result->count > 0, 'has some rows' );
        my $id = $result->content->{workflows}[0]{id};
        ok( $id, 'workflow id' );

        my $wf = $p->repos->actions->workflows->get(
            user        => 'Perl',
            repo        => 'docker-perl-tester',
            workflow_id => $id,
        );
        ok( $wf->success, 'success' );
        is( $wf->content->{id}, $id, 'id matches' );
    };
}

done_testing;