t: Test Projects JSON serialization and deserialization

[?]
Apr 26, 2021, 11:29 PM
LN3E2P4E6QRVXFKSGCD2FARP5YFGDU2CIPJYWCX5MAEPWXK6CP7QC

Dependencies

  • [2] MQLCUSZL Test the fake derivations channel, asserting nested packages are properly represented.

Change contents

  • file addition: projects.t (----------)
    [2.451]
    use feature 'unicode_strings';
    use strict;
    use Setup;
    use JSON qw(decode_json);
    my %ctx = test_init();
    require Hydra::Schema;
    require Hydra::Model::DB;
    require Hydra::Helper::Nix;
    use HTTP::Request::Common;
    use Test2::V0;
    require Catalyst::Test;
    Catalyst::Test->import('Hydra');
    my $db = Hydra::Model::DB->new;
    hydra_setup($db);
    my $project = $db->resultset('Projects')->create({name => "tests", displayname => "", owner => "root"});
    my $projectinfo = request(GET '/project/tests',
    Accept => 'application/json',
    );
    ok($projectinfo->is_success);
    is(decode_json($projectinfo->content), {
    description => undef,
    displayname => "",
    enabled => JSON::true,
    hidden => JSON::false,
    homepage => undef,
    jobsets => [],
    name => "tests",
    owner => "root"
    });
    done_testing;