Add Site Metadata Endpoint and API Key Management
- Introduced a new Site Metadata endpoint (`GET /wp-json/igny8/v1/site-metadata/`) for retrieving available post types and taxonomies, including counts. - Added API key input in the admin settings for authentication, with secure storage and revocation functionality. - Implemented a toggle for enabling/disabling two-way sync operations. - Updated documentation to reflect new features and usage examples. - Enhanced permission checks for REST API calls to ensure secure access.
This commit is contained in:
28
igny8-wp-integration-plugin/tests/test-revoke-api-key.php
Normal file
28
igny8-wp-integration-plugin/tests/test-revoke-api-key.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Unit test for API key revoke handler
|
||||
*
|
||||
* @package Igny8Bridge
|
||||
*/
|
||||
|
||||
class Test_Revoke_Api_Key extends WP_UnitTestCase {
|
||||
|
||||
public function test_revoke_api_key_clears_options() {
|
||||
// Simulate stored API key and tokens
|
||||
update_option('igny8_api_key', 'test-key-123');
|
||||
update_option('igny8_access_token', 'test-key-123');
|
||||
update_option('igny8_refresh_token', 'refresh-123');
|
||||
update_option('igny8_token_refreshed_at', time());
|
||||
|
||||
// Call revoke
|
||||
Igny8Admin::revoke_api_key();
|
||||
|
||||
// Assert removed
|
||||
$this->assertFalse(get_option('igny8_api_key'));
|
||||
$this->assertFalse(get_option('igny8_access_token'));
|
||||
$this->assertFalse(get_option('igny8_refresh_token'));
|
||||
$this->assertFalse(get_option('igny8_token_refreshed_at'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user