t: Test Projects JSON serialization and deserialization

This commit is contained in:
Graham Christensen 2021-04-26 16:29:04 -07:00 committed by Cole Helbling
parent f2b9649bf2
commit f0ede5f8b8
No known key found for this signature in database
GPG key ID: B37E0F2371016A4C

38
t/Controller/projects.t Normal file
View file

@ -0,0 +1,38 @@
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;