From: Dylan William Hardison Date: Tue, 27 Nov 2018 03:10:49 +0000 (-0500) Subject: no bug - remove dup function from testing utils X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2163eedd48b80498169ae05d1fac9a9657b38b7;p=thirdparty%2Fbugzilla.git no bug - remove dup function from testing utils --- diff --git a/Bugzilla/Test/Util.pm b/Bugzilla/Test/Util.pm index 16d82ac1e..8ce98ffe6 100644 --- a/Bugzilla/Test/Util.pm +++ b/Bugzilla/Test/Util.pm @@ -50,8 +50,7 @@ sub create_oauth_client { my $id = generate_random_password(20); my $secret = generate_random_password(40); - $dbh->do( - 'INSERT INTO oauth2_client (id, description, secret) VALUES (?, ?, ?)', + $dbh->do('INSERT INTO oauth2_client (id, description, secret) VALUES (?, ?, ?)', undef, $id, $description, $secret); foreach my $scope (@{$scopes}) { @@ -67,24 +66,26 @@ sub create_oauth_client { ); } - return $dbh->selectrow_hashref('SELECT * FROM oauth2_client WHERE id = ?', undef, $id); + return $dbh->selectrow_hashref('SELECT * FROM oauth2_client WHERE id = ?', + undef, $id); } 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); - } + 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); + } } sub create_bug { @@ -140,24 +141,6 @@ sub create_bug { return Bugzilla::Bug->create($option); } -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); - } -} - sub _json_content_type { $_->headers->content_type('application/json') } sub mock_useragent_tx {