Net-Async-Authentik

 view release on metacpan or  search on metacpan

t/50-api.t  view on Meta::CPAN

};

subtest 'brands, certificates and blueprints' => sub {
  ok( $api->current_brand_f->get, 'current_brand' );
  ok( scalar @{ $api->list_brands_f->get }, 'list_brands' );
  # the public view cannot be written back; the list is where the key is
  my ( $brand ) = grep { $_->{default} } @{ $api->list_brands_f->get };
  ok( $brand && $brand->{brand_uuid}, 'the list carries the brand_uuid' );
  is( $api->update_brand_f( $brand->{brand_uuid}, { branding_title => 'Probe' } )->get->{branding_title}, 'Probe', 'update_brand' );

  is( $api->find_certificate_f('authentik Self-signed Certificate')->get->{private_key_available}, 1, 'find_certificate' );
  is( $api->find_certificate_f('nope')->get, undef, 'and nothing for an unknown one' );

  my $blueprint = $api->create_blueprint_f( { name => 'probe', content => "version: 1\n" } )->get;
  is( $blueprint->{status}, 'unknown', 'a new blueprint has not run yet' );
  is( $api->apply_blueprint_f( $blueprint->{pk} )->get->{status}, 'successful', 'apply_blueprint' );
  is( $api->get_blueprint_f( $blueprint->{pk} )->get->{status}, 'successful', 'get_blueprint' );
  ok( $api->delete_blueprint_f( $blueprint->{pk} )->get, 'delete_blueprint' );
};

done_testing;

t/lib/FakeAuthentik.pm  view on Meta::CPAN

    defaults => { evaluate_on_plan => \0, re_evaluate_policies => \1, policy_engine_mode => 'any', invalid_response_action => 'retry' }
  },
  stages => {
    path => '/api/v3/stages/', detail => 'pk', key => 'name', model => 'Stage', pk => 'uuid',
    required => [qw( name )], duplicate => 'stage with this name already exists.',
    defaults => {}
  },
  certificates => {
    path => '/api/v3/crypto/certificatekeypairs/', detail => 'pk', key => 'name', model => 'CertificateKeyPair', pk => 'uuid',
    required => [qw( name )], duplicate => 'Certificate-Key Pair with this name already exists.',
    defaults => { private_key_available => \1, managed => undef }
  },
  brands => {
    path => '/api/v3/core/brands/', detail => 'brand_uuid', key => 'domain', model => 'Brand', pk => 'uuid',
    required => [qw( domain )], duplicate => 'Brand with this domain already exists.',
    defaults => { default => \0 }
  },
  blueprints => {
    path => '/api/v3/managed/blueprints/', detail => 'pk', key => 'name', model => 'BlueprintInstance', pk => 'uuid',
    required => [qw( name )], duplicate => 'Blueprint Instance with this name already exists.',
    defaults => { enabled => \1, status => 'unknown', managed_models => [], metadata => {}, context => {} }



( run in 1.262 second using v1.01-cache-2.11-cpan-8379b9b8ec2 )