-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr_get_store_status_test.go
55 lines (47 loc) · 1.48 KB
/
r_get_store_status_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package easclient_test
import (
"context"
"encoding/xml"
"testing"
"github.com/DEXPRO-Solutions-GmbH/easclient"
"github.com/DEXPRO-Solutions-GmbH/easclient/eastest"
"github.com/DEXPRO-Solutions-GmbH/easclient/internal"
"github.com/stretchr/testify/require"
)
func TestStoreClient_GetStoreStatus(t *testing.T) {
internal.TestPrelude(t)
eastest.SkipInCI(t)
ctx := context.Background()
user := easclient.NewUserClaims("[email protected]")
ctx = user.SetOnContext(ctx)
status, err := eastest.DefaultClient().GetStoreStatus(ctx)
require.NoError(t, err)
require.NotNil(t, status)
}
func Test_UnmarshalStoreStatus(t *testing.T) {
respBody := `<?xml version="1.0" encoding="UTF-8"?>
<status xmlns="http://namespace.otris.de/2010/09/archive" xmlns:xlink="http://www.w3.org/1999/xlink">
<registry>
<records>
<all>34</all>
<indexed>34</indexed>
</records>
<attachments>
<all>4</all>
<indexed>4</indexed>
</attachments>
</registry>
<index>
<documents>38</documents>
<isCurrent>true</isCurrent>
<hasDeletions>false</hasDeletions>
</index>
</status>`
var resp easclient.StoreStatus
require.NoError(t, xml.Unmarshal([]byte(respBody), &resp))
require.Equal(t, 34, resp.Registry.Records.All)
require.Equal(t, 34, resp.Registry.Records.Indexed)
require.Equal(t, 38, resp.Index.Documents)
require.Equal(t, true, resp.Index.IsCurrent)
require.Equal(t, false, resp.Index.HasDeletions)
}