2024-06-14 18:23:06 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from core.model_runtime.errors.validate import CredentialsValidateFailedError
|
|
|
|
from core.model_runtime.model_providers.novita.novita import NovitaProvider
|
|
|
|
|
|
|
|
|
|
|
|
def test_validate_provider_credentials():
|
|
|
|
provider = NovitaProvider()
|
|
|
|
|
|
|
|
with pytest.raises(CredentialsValidateFailedError):
|
2024-08-23 23:52:25 +08:00
|
|
|
provider.validate_provider_credentials(credentials={})
|
2024-06-14 18:23:06 +08:00
|
|
|
|
|
|
|
provider.validate_provider_credentials(
|
|
|
|
credentials={
|
2024-08-23 23:52:25 +08:00
|
|
|
"api_key": os.environ.get("NOVITA_API_KEY"),
|
2024-06-14 18:23:06 +08:00
|
|
|
}
|
|
|
|
)
|