File: config.t

package info (click to toggle)
dh-make-raku 0.8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: perl: 595; makefile: 4
file content (29 lines) | stat: -rw-r--r-- 855 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
use strict;
use warnings;
use v5.20;

use Test::More;
use Path::Tiny;
use Config::Model qw/cme/;

use DhMakeRaku;
use DhMakeRaku::Config;

subtest "read git credentials" => sub {
    my $config = DhMakeRaku::Config::user_config;
    my $cred_file = path("/tmp/dummy-git-creds");
    $cred_file->spew('https://dod:notmytoken@salsa.debian.org');
    DhMakeRaku::Config::read_git_credentials($config, $cred_file);
    is($config->{user},"dod","check user retrieved from git credentials");
    is($config->{private_token},"notmytoken","check token retrieved from git credentials");
};

subtest "config from env" => sub {
    my $config = DhMakeRaku::Config::user_config;
    $ENV{DRT_SALSA_USER}="foo";
    DhMakeRaku::Config::udpate_config_from_environment ($config);
    is($config->{user},"foo","check user retrieved from environment");
};


done_testing;