]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
no bug - remove dup function from testing utils
authorDylan William Hardison <dylan@hardison.net>
Tue, 27 Nov 2018 03:10:49 +0000 (22:10 -0500)
committerDylan William Hardison <dylan@hardison.net>
Tue, 27 Nov 2018 03:12:39 +0000 (22:12 -0500)
Bugzilla/Test/Util.pm

index 16d82ac1ef48816b8a8d26a1a3442960bbc15605..8ce98ffe64ac5263c42e01ea56307aa37b97f331 100644 (file)
@@ -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 {