mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Test: onedrive related
This commit is contained in:
@@ -1,7 +1,31 @@
|
||||
package onedrive
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
model "github.com/HFO4/cloudreve/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewClient(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
// getOAuthEndpoint失败
|
||||
{
|
||||
policy := model.Policy{
|
||||
BaseURL: string([]byte{0x7f}),
|
||||
}
|
||||
res, err := NewClient(&policy)
|
||||
asserts.Error(err)
|
||||
asserts.Nil(res)
|
||||
}
|
||||
|
||||
// 成功
|
||||
{
|
||||
policy := model.Policy{}
|
||||
res, err := NewClient(&policy)
|
||||
asserts.NoError(err)
|
||||
asserts.NotNil(res)
|
||||
asserts.NotNil(res.Credential)
|
||||
asserts.NotNil(res.Endpoints)
|
||||
asserts.NotNil(res.Endpoints.OAuthEndpoints)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user