mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-02 02:59:00 -05:00
* upgrade Stalwart image for devtools/full to 0.14.1 * re-assert which features are implemented or not in 0.14.1 * refactor the integration tests yet again to make it clearer and easier to see those "features-or-not" * get rid of old tests that are now better covered by integration tests * rewrite how we compare expected and actual objects in integration tests, finally having found a way to ignore the @type attribute properly instead of having to mutate all objects to remove it
25 lines
833 B
Go
25 lines
833 B
Go
package jmap
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestUnmarshallingError(t *testing.T) {
|
|
require := require.New(t)
|
|
|
|
responseBody := `{"methodResponses":[["error",{"type":"forbidden","description":"You do not have access to account a"},"a:0"]],"sessionState":"3e25b2a0"}`
|
|
var response Response
|
|
err := json.Unmarshal([]byte(responseBody), &response)
|
|
require.NoError(err)
|
|
require.Len(response.MethodResponses, 1)
|
|
require.Equal(ErrorCommand, response.MethodResponses[0].Command)
|
|
require.Equal("a:0", response.MethodResponses[0].Tag)
|
|
require.IsType(ErrorResponse{}, response.MethodResponses[0].Parameters)
|
|
er, _ := response.MethodResponses[0].Parameters.(ErrorResponse)
|
|
require.Equal("forbidden", er.Type)
|
|
require.Equal("You do not have access to account a", er.Description)
|
|
}
|