Skip to content

Commit e2c3bbe

Browse files
Validation Test Case For Show as Button Parameter (#783)
### Changes - Added a test case for newly added `show_as_button parameter` in the [Organization Post API ](https://auth0.com/docs/api/management/v2/organizations/post-organizations) ### References -[Organization Post API ](https://auth0.com/docs/api/management/v2/organizations/post-organizations) ### Testing - [x] This change adds unit test coverage - [x] This change adds integration test coverage - [x] This change has been tested on the latest version of the platform/language or why not ### Contributor Checklist - [x] I agree to adhere to the [Auth0 General Contribution Guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md). - [x] I agree to uphold the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md).
1 parent e7d9916 commit e2c3bbe

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/Unit/API/Management/OrganizationsTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,3 +521,36 @@
521521
$query = $this->api->getRequestQuery(null);
522522
expect($query)->toContain('grant_ids=' . rawurlencode($grantIds));
523523
});
524+
525+
test('create() issues an appropriate request with show as button parameter in enabled connections', function(): void {
526+
$mock = (object) [
527+
'id' => uniqid(),
528+
'name' => uniqid(),
529+
'branding' => [
530+
'logo_url' => uniqid(),
531+
],
532+
'metadata' => [
533+
'test' => uniqid()
534+
],
535+
'body' => [
536+
'enabled_connections' => [
537+
'connection_id' => uniqid(),
538+
'show_as_button' => true
539+
]
540+
]
541+
];
542+
543+
$this->endpoint->create($mock->id, $mock->name, $mock->branding, $mock->metadata, $mock->body);
544+
545+
expect($this->api->getRequestMethod())->toEqual('POST');
546+
expect($this->api->getRequestUrl())->toEndWith('/api/v2/organizations');
547+
548+
$body = $this->api->getRequestBody();
549+
550+
$this->assertArrayHasKey('enabled_connections', $body);
551+
$this->assertArrayHasKey('show_as_button', $body['enabled_connections']);
552+
expect($body['enabled_connections']['show_as_button'])->toEqual($mock->body['enabled_connections']['show_as_button']);
553+
554+
$body = $this->api->getRequestBodyAsString();
555+
expect($body)->toEqual(json_encode(array_merge(['name' => $mock->id, 'display_name' => $mock->name, 'branding' => $mock->branding, 'metadata' => $mock->metadata], $mock->body)));
556+
});

0 commit comments

Comments
 (0)