This commit is contained in:
Huong Nguyen 2024-10-14 11:08:25 +07:00
commit 7014d61d93
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
9 changed files with 1 additions and 18 deletions

View File

@ -28,7 +28,6 @@ Feature: AI Course assist summarise
And I enable "openai" "aiprovider" plugin
And the following config values are set as admin:
| apikey | 123 | aiprovider_openai |
| orgid | abc | aiprovider_openai |
And I enable "courseassist" "aiplacement" plugin
@javascript

View File

@ -47,7 +47,6 @@ final class utils_test extends \advanced_testcase {
set_config('enabled', 1, 'aiprovider_openai');
set_config('apikey', '123', 'aiprovider_openai');
set_config('orgid', 'abc', 'aiprovider_openai');
// Plugin is not enabled.
$this->setUser($user1);

View File

@ -73,7 +73,6 @@ final class utils_test extends \advanced_testcase {
set_config('enabled', 1, 'aiprovider_openai');
set_config('apikey', '123', 'aiprovider_openai');
set_config('orgid', 'abc', 'aiprovider_openai');
// Plugin is not enabled.
$this->setUser($this->users[1]);

View File

@ -214,6 +214,6 @@ class provider extends \core_ai\provider {
* @return bool Return true if configured.
*/
public function is_provider_configured(): bool {
return !empty($this->apikey) && !empty($this->orgid);
return !empty($this->apikey);
}
}

View File

@ -121,15 +121,8 @@ final class provider_test extends \advanced_testcase {
$provider = new \aiprovider_openai\provider();
$this->assertFalse($provider->is_provider_configured());
// Partially configured values.
set_config('apikey', '123', 'aiprovider_openai');
set_config('orgid', '', 'aiprovider_openai');
$provider = new \aiprovider_openai\provider();
$this->assertFalse($provider->is_provider_configured());
// Properly configured values.
set_config('apikey', '123', 'aiprovider_openai');
set_config('orgid', 'abc', 'aiprovider_openai');
$provider = new \aiprovider_openai\provider();
$this->assertTrue($provider->is_provider_configured());
}

View File

@ -34,7 +34,6 @@ Feature: An administrator can manage AI subsystem settings
And I should see "OpenAI API Provider enabled."
And the following config values are set as admin:
| apikey | 123 | aiprovider_openai |
| orgid | abc | aiprovider_openai |
And I navigate to "AI > AI placements" in site administration
And I click on the "Settings" link in the table row containing "HTML Text Editor Placement"
Then I should not see "This action is unavailable."
@ -57,7 +56,6 @@ Feature: An administrator can manage AI subsystem settings
And I should see "OpenAI API Provider enabled."
And the following config values are set as admin:
| apikey | 123 | aiprovider_openai |
| orgid | abc | aiprovider_openai |
And I click on the "Settings" link in the table row containing "OpenAI API Provider"
And I toggle the "Generate text" admin switch "off"
And I navigate to "AI > AI placements" in site administration

View File

@ -75,7 +75,6 @@ final class manager_test extends \advanced_testcase {
$this->resetAfterTest();
set_config('enabled', 1, 'aiprovider_openai');
set_config('apikey', '123', 'aiprovider_openai');
set_config('orgid', 'abc', 'aiprovider_openai');
$manager = \core\di::get(manager::class);
$actions = [
@ -144,7 +143,6 @@ final class manager_test extends \advanced_testcase {
// Enable the providers.
set_config('enabled', 1, 'aiprovider_openai');
set_config('apikey', '123', 'aiprovider_openai');
set_config('orgid', 'abc', 'aiprovider_openai');
set_config('enabled', 1, 'aiprovider_azureai');
set_config('apikey', '123', 'aiprovider_azureai');
set_config('endpoint', 'abc', 'aiprovider_azureai');
@ -420,7 +418,6 @@ final class manager_test extends \advanced_testcase {
$manager = \core_plugin_manager::resolve_plugininfo_class('aiprovider');
$manager::enable_plugin('openai', 1);
set_config('apikey', '123', 'aiprovider_openai');
set_config('orgid', 'abc', 'aiprovider_openai');
// Should now be available.
$result = manager::is_action_available($action);

View File

@ -31,7 +31,6 @@ Feature: Generate image using AI
And I enable "openai" "aiprovider" plugin
And the following config values are set as admin:
| apikey | 123 | aiprovider_openai |
| orgid | abc | aiprovider_openai |
And I enable "editor" "aiplacement" plugin
@javascript

View File

@ -32,7 +32,6 @@ Feature: Generate text using AI
And I enable "openai" "aiprovider" plugin
And the following config values are set as admin:
| apikey | 123 | aiprovider_openai |
| orgid | abc | aiprovider_openai |
And I enable "editor" "aiplacement" plugin
@javascript