示例#1
0
func TestCredentiasModifyError(t *testing.T) {
	t.Parallel()
	c := parse.Client{
		Credentials: parse.RestAPIKey{},
	}
	_, err := c.Do(&http.Request{}, nil, nil)
	ensure.Err(t, err, regexp.MustCompile("empty ApplicationID"))
}
示例#2
0
func TestMissingCredentials(t *testing.T) {
	t.Parallel()
	var c parse.Client
	req := http.Request{Method: "GET", URL: &url.URL{Path: "classes/Foo/Bar"}}
	_, err := c.Do(&req, nil, nil)
	ensure.NotNil(t, err)
	ensure.Err(t, err, regexp.MustCompile(`parse: api error with message="unauthorized"`))
}