Add a new test case when verifying creator key with API

[MAILPOET-4464]
This commit is contained in:
Sam Najian
2022-10-12 12:02:11 +02:00
committed by Aschepikov
parent cdb5b0d3cd
commit 0f45727ddc

View File

@@ -591,6 +591,26 @@ class ServicesTest extends \MailPoetTest {
$this->diContainer->get(SettingsRepository::class)->truncate();
}
public function testItRespondsWithCorrectMessageIfKeyDoesntSupportMSS() {
$bridge = $this->make(
new Bridge(),
[
'checkMSSKey' => [
'state' => Bridge::KEY_VALID_UNDERPRIVILEGED,
'code' => 403
],
'storeMSSKeyAndState' => Expected::once(),
]
);
$servicesEndpoint = $this->createServicesEndpointWithMocks(['bridge' => $bridge]);
$response = $servicesEndpoint->checkMSSKey($this->data);
expect($response->status)->equals(APIResponse::STATUS_OK);
expect($response->data['message'])->stringContainsString(
'Your Premium key has been successfully validated, but is not valid for MailPoet Sending Service'
);
}
private function createServicesEndpointWithMocks(array $mocks) {
return new Services(
$mocks['bridge'] ?? $this->diContainer->get(Bridge::class),