summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-09-25 23:30:28 +0200
committerGitHub <noreply@github.com>2018-09-25 23:30:28 +0200
commitdeec4ab75d6478f51d6c72a230343ab955116a6b (patch)
tree168e7380ded24cedac218abbc0212567ce41b67c /Bugzilla
parent137a983d511bfed23a914946dde4b7cf1108a726 (diff)
downloadbugzilla-deec4ab75d6478f51d6c72a230343ab955116a6b.tar.gz
bugzilla-deec4ab75d6478f51d6c72a230343ab955116a6b.tar.xz
Bug 1494065 - Add a basic test using Test::Mojo
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Quantum.pm2
-rw-r--r--Bugzilla/Test/Util.pm20
2 files changed, 20 insertions, 2 deletions
diff --git a/Bugzilla/Quantum.pm b/Bugzilla/Quantum.pm
index 8af06c477..c64e57e13 100644
--- a/Bugzilla/Quantum.pm
+++ b/Bugzilla/Quantum.pm
@@ -34,7 +34,7 @@ sub startup {
DEBUG('Starting up');
$self->plugin('Bugzilla::Quantum::Plugin::Glue');
- $self->plugin('Bugzilla::Quantum::Plugin::Hostage');
+ $self->plugin('Bugzilla::Quantum::Plugin::Hostage') unless $ENV{BUGZILLA_DISABLE_HOSTAGE};
$self->plugin('Bugzilla::Quantum::Plugin::BlockIP');
$self->plugin('Bugzilla::Quantum::Plugin::BasicAuth');
diff --git a/Bugzilla/Test/Util.pm b/Bugzilla/Test/Util.pm
index 02c842658..8124c25ee 100644
--- a/Bugzilla/Test/Util.pm
+++ b/Bugzilla/Test/Util.pm
@@ -12,9 +12,10 @@ use strict;
use warnings;
use base qw(Exporter);
-our @EXPORT = qw(create_user);
+our @EXPORT = qw(create_user issue_api_key);
use Bugzilla::User;
+use Bugzilla::User::APIKey;
sub create_user {
my ($login, $password, %extra) = @_;
@@ -29,4 +30,21 @@ sub create_user {
});
}
+sub issue_api_key {
+ my ($login, $given_api_key) = @_;
+ my $user = Bugzilla::User->check({ name => $login });
+
+ my $params = {
+ user_id => $user->id,
+ description => 'Bugzilla::Test::Util::issue_api_key',
+ api_key => $given_api_key,
+ };
+
+ if ($given_api_key) {
+ return Bugzilla::User::APIKey->create_special($params);
+ } else {
+ return Bugzilla::User::APIKey->create($params);
+ }
+}
+
1;