Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jan 18, 2025
1 parent 4be8600 commit f554938
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
11 changes: 9 additions & 2 deletions tests/Aws/SigningClientDecoratorGuzzleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ public function testGuzzleRequestIsSigned(): void
$credentials = $this->createMock(CredentialsInterface::class);
$signer = new SignatureV4('es', 'us-east-1');

$decorator = new SigningClientDecorator($guzzleClient, $credentials, $signer);
$decorator = new SigningClientDecorator(
$guzzleClient,
$credentials,
$signer,
[
'Host' => 'search.host'
]
);

$transport = (new TransportFactory())
->setHttpClient($decorator)
Expand All @@ -66,7 +73,7 @@ public function testGuzzleRequestIsSigned(): void

// Check the last request to ensure it was signed and has a host header.
$lastRequest = $mockHandler->getLastRequest();
$this->assertEquals('localhost:9200', $lastRequest->getHeader('Host')[0]);
$this->assertEquals('search.host', $lastRequest->getHeader('Host')[0]);
$this->assertNotEmpty($lastRequest->getHeader('x-amz-content-sha256'));
$this->assertNotEmpty($lastRequest->getHeader('x-amz-date'));
$this->assertNotEmpty($lastRequest->getHeader('Authorization'));
Expand Down
12 changes: 8 additions & 4 deletions tests/Aws/SigningClientDecoratorSymfonyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ public function testSymfonyRequestIsSigned(): void
$credentials = $this->createMock(CredentialsInterface::class);
$signer = new SignatureV4('es', 'us-east-1');

$decorator = new SigningClientDecorator($symfonyPsr18Client, $credentials, $signer);
$decorator = new SigningClientDecorator(
$symfonyPsr18Client,
$credentials,
$signer,
[
'Host' => 'search.host'
]
);

$transport = (new TransportFactory())
->setHttpClient($decorator)
Expand All @@ -71,8 +78,5 @@ public function testSymfonyRequestIsSigned(): void
$this->assertArrayHasKey('x-amz-content-sha256', $requestHeaders);
$this->assertArrayHasKey('x-amz-date', $requestHeaders);
$this->assertArrayHasKey('host', $requestHeaders);

}


}

0 comments on commit f554938

Please sign in to comment.