mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-05-20 01:28:36 +08:00

Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: Garfield Dai <dai.hai@foxmail.com> Co-authored-by: chenhe <guchenhe@gmail.com> Co-authored-by: jyong <jyong@dify.ai> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Yeuoly <admin@srmxy.cn>
21 lines
541 B
Python
21 lines
541 B
Python
import os
|
|
|
|
import pytest
|
|
|
|
from core.model_runtime.errors.validate import CredentialsValidateFailedError
|
|
from core.model_runtime.model_providers.zhipuai.zhipuai import ZhipuaiProvider
|
|
|
|
def test_validate_provider_credentials():
|
|
provider = ZhipuaiProvider()
|
|
|
|
with pytest.raises(CredentialsValidateFailedError):
|
|
provider.validate_provider_credentials(
|
|
credentials={}
|
|
)
|
|
|
|
provider.validate_provider_credentials(
|
|
credentials={
|
|
'api_key': os.environ.get('ZHIPUAI_API_KEY')
|
|
}
|
|
)
|