Skip to content

Commit

Permalink
Use the new(er) getServiceAccount method instead of hard coding the s…
Browse files Browse the repository at this point in the history
…torage service account (#1666)

* use getServiceAccount in favor of hard coded approach

* add space

* remove unnecessary variables
  • Loading branch information
dwsupplee authored Feb 6, 2019
1 parent 8b93fb8 commit 22b52f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Storage/tests/System/ManageNotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ public function testCreateAndListNotifications()
{
$created = [];
$topic = self::createTopic(self::$pubsubClient, uniqid(self::TESTING_PREFIX));
$projectId = self::getProjectId(getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH'));
$policy = $topic->iam()->policy();
$policy['bindings'] = [
[
'role' => 'roles/pubsub.publisher',
'members' => [
"serviceAccount:$projectId@gs-project-accounts.iam.gserviceaccount.com"
'serviceAccount:' . self::$client->getServiceAccount()
]
]
];
Expand Down
7 changes: 1 addition & 6 deletions Storage/tests/System/RequesterPaysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,12 @@ public static function setupBeforeClass()

$requesterKeyFilePath = getenv('GOOGLE_CLOUD_PHP_WHITELIST_TESTS_KEY_PATH');
$ownerKeyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH');

self::$requesterKeyFile = json_decode(file_get_contents($requesterKeyFilePath), true);
self::$requesterEmail = self::$requesterKeyFile['client_email'];
self::$requesterProject = self::$requesterKeyFile['project_id'];

self::$ownerKeyFile = json_decode(file_get_contents($ownerKeyFilePath), true);
self::$ownerEmail = self::$ownerKeyFile['client_email'];
self::$ownerProject = self::$ownerKeyFile['project_id'];

self::$bucketName = uniqid(self::TESTING_PREFIX);

$client = self::$client;

// Owner bucket instance is a bucket class with requester pays turned on
Expand Down Expand Up @@ -111,7 +106,7 @@ public static function setupBeforeClass()
$p['bindings'][] = [
'role' => 'roles/pubsub.publisher',
'members' => [
'serviceAccount:'. self::$ownerProject .'@gs-project-accounts.iam.gserviceaccount.com',
'serviceAccount:' . $client->getServiceAccount()
]
];
self::$topic->iam()->setPolicy($p);
Expand Down

0 comments on commit 22b52f2

Please sign in to comment.