Skip to content
Snippets Groups Projects
Commit 430530b4 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- init

parent ecbe7dc6
No related branches found
No related tags found
No related merge requests found
use v5.36;
use Test::Cmd;
use Test::More tests =>6;
use Path::Tiny;
my $perl = $^X;
my $testapp = Test::Cmd->new(
prog => path(__FILE__)->parent->parent->child('bin')->child('ta-tool.pl'),
workdir => '',
subdir => 'bin',
#verbose => 1,
interpreter => "$perl -I lib/ ",
);
local $ENV{'HOME'} = $testapp->workpath();
my $config_dir = path($testapp->workpath())->child('.config');
$config_dir->mkpath();
my $config_file = $config_dir->child('ta-tool.rc');
my $cache_dir = path($testapp->workpath())->child('.cache');
$cache_dir->mkpath();
my $cache_file = $cache_dir->child('ta-tool.cache');
$config_file->spew_utf8(<<_CFG_);
---
elasticsearchhost: sdvlzaamtestfotothek01.slub-dresden.de
elasticsearchport: 9200
httponly: 1
logdir: /tmp
password: 839852bed005a7f1237578a6ac1197c142f7d0dd58bb248446dc7849d4bf770902e7f980ad83d39008ad638bc41e2345
user: lza
_CFG_
# tests
note "check cli params";
$testapp->run(args =>'report');
#say "STDOUT:",$testapp->stdout;
#say "STDERR:",$testapp->stderr;
like($testapp->stdout, qr/^:lang: en\n:date:.*\n:generator:.*\n== Report from.*\n=== count/s, 'ta-tool report, base, stdout');
like($testapp->stderr, qr/^reporting for period/s, 'ta-tool report, base, stderr');
is($? >> 8, 0, 'ta-tool report, base, exit status');
$testapp->run(args =>'report --output-as-csv');
#say "STDOUT:",$testapp->stdout;
#say "STDERR:",$testapp->stderr;
like($testapp->stdout, qr/^"set","subset","aip_state","flavour","value"\n"([a-z]+)","","([a-z]+)","([a-z]+)",\d+(\.\d+)?\n/s, 'ta-tool report, base, stdout');
like($testapp->stderr, qr/^reporting for period/s, 'ta-tool report, base, stderr');
is($? >> 8, 0, 'ta-tool report, base, exit status');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment