Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
Option to use external GitHub API auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Aug 23, 2018
1 parent 75e4c35 commit 0e47b9f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion t/App/KSP_CKAN/NetKAN.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $test->create_repo("CKAN-meta");
$test->create_repo("NetKAN");

# Config
$test->create_config(nogh => 1);
$test->create_config();
my $config = App::KSP_CKAN::Tools::Config->new(
file => $test->tmp."/.ksp-ckan",
);
Expand Down
3 changes: 2 additions & 1 deletion t/App/KSP_CKAN/Tools/Config.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ my $config = App::KSP_CKAN::Tools::Config->new(

is($config->CKAN_meta, $test->_tmp."/data/CKAN-meta", "NetKAN loaded from config");
is($config->NetKAN, $test->_tmp."/data/NetKAN", "NetKAN loaded from config");
is($config->GH_token, "123456789", "GH_token loaded from config");
my $token = $ENV{GH_token} // '123456789';
is($config->GH_token, $token, "GH_token loaded from config");
is($config->working, $test->_tmp."/working", "working loaded from config");
is(-d $config->working, 1, "working was automatically created");
is($config->cache, $test->_tmp."/cache", "cache loaded from config");
Expand Down
4 changes: 2 additions & 2 deletions t/App/KSP_CKAN/Tools/NetKAN.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use App::KSP_CKAN::Status;
my $test = App::KSP_CKAN::Test->new();

# Config
$test->create_config(nogh => 1);
$test->create_config();
my $config = App::KSP_CKAN::Tools::Config->new(
file => $test->tmp."/.ksp-ckan",
);
Expand Down Expand Up @@ -85,7 +85,7 @@ TODO: {
isnt( $netkan->inflate, 0, "Return failure correctly" );

subtest 'Status Setting' => sub {
like($status->status->{'DogeCoinFlag-broken'}{last_error}, qr/^JSON deserialization error.+/, "'last_error' set on failure");
like($status->status->{'DogeCoinFlag-broken'}{last_error}, qr/Required property 'version' not found/, "'last_error' set on failure");
is($status->status->{'DogeCoinFlag-broken'}{failed}, 1, "'failed' true on failure");
is($status->status->{'DogeCoinFlag-broken'}{last_indexed}, undef, "'last_index' undef when no successful indexing has ever occured");
is($status->status->{'DogeCoinFlag'}{last_error}, undef, "'last_error' undef on success");
Expand Down
4 changes: 2 additions & 2 deletions t/App/KSP_CKAN/WebHooks/InflateNetKAN.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ subtest 'Scalar Identifier' => sub {
$test->create_repo("NetKAN");

# Config
$test->create_config(nogh => 1);
$test->create_config();
my $config = App::KSP_CKAN::Tools::Config->new(
file => $test->tmp."/.ksp-ckan",
);
Expand Down Expand Up @@ -54,7 +54,7 @@ subtest 'Array of Identifiers' => sub {
$test->create_repo("NetKAN");

# Config
$test->create_config(nogh => 1);
$test->create_config();
my $config = App::KSP_CKAN::Tools::Config->new(
file => $test->tmp."/.ksp-ckan",
);
Expand Down
5 changes: 4 additions & 1 deletion t/lib/App/KSP_CKAN/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ method create_config(:$optional = 1, :$nogh = 0) {

# TODO: This is a little ugly.
if ($optional) {
print $in "GH_token=123456789\n" if ! $nogh;
if (!$nogh) {
my $token = $ENV{GH_token} // '123456789';
print $in "GH_token=$token\n";
}
print $in "working=".$self->_tmp."/working\n";
print $in "cache=".$self->_tmp."/cache\n";
print $in "IA_collection=collection\n";
Expand Down

0 comments on commit 0e47b9f

Please sign in to comment.