-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package Integrations::Confirm::Dummy; | ||
use Path::Tiny; | ||
use Moo; | ||
extends 'Integrations::Confirm'; | ||
sub _build_config_file { path(__FILE__)->sibling("confirm.yml")->stringify } | ||
|
||
package main; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
use Test::MockModule; | ||
use Test::Output; | ||
use HTTP::Response; | ||
use JSON::MaybeXS; | ||
|
||
BEGIN { $ENV{TEST_MODE} = 1; } | ||
|
||
my $lwp = Test::MockModule->new('LWP::UserAgent'); | ||
|
||
$lwp->mock(request => sub { | ||
return HTTP::Response->new(200, 'OK', [], encode_json({ | ||
data => {}, | ||
errors => [ | ||
{ | ||
message => "Uh-oh spaghettio!", | ||
} | ||
] | ||
}) | ||
); | ||
}); | ||
|
||
my $integration = Integrations::Confirm::Dummy->new; | ||
|
||
subtest "GraphQL errors are logged " => sub { | ||
local $ENV{TEST_LOGGER} = 'warn'; | ||
stderr_like { | ||
$integration->perform_request_graphql(type => 'job_types'); | ||
} qr/.*Uh-oh spaghettio!.*/, 'Got expected warning log for errors.'; | ||
}; | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
graphql_url: "http://example.org/graphql" | ||
graphql_key: "key" |