-
Notifications
You must be signed in to change notification settings - Fork 0
/
r_store_post_record_test.go
43 lines (34 loc) · 1.13 KB
/
r_store_post_record_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
package easclient_test
import (
"context"
"testing"
"github.com/DEXPRO-Solutions-GmbH/easclient"
"github.com/DEXPRO-Solutions-GmbH/easclient/eastest"
"github.com/DEXPRO-Solutions-GmbH/easclient/internal"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
)
func TestStoreClient_PostRecord(t *testing.T) {
internal.TestPrelude(t)
eastest.SkipInCI(t)
ctx := context.Background()
user := easclient.NewUserClaims("[email protected]")
ctx = user.SetOnContext(ctx)
res, err := eastest.DefaultClient().PostRecord(ctx, &easclient.RecordRequest{
Title: "This is my archive file",
Fields: map[string]string{
"Creditor": "DE123456789",
"Debitor": "DE987654321",
},
})
require.NoError(t, err)
require.NotNil(t, res)
require.NotEqual(t, uuid.Nil, res.ID.Value)
// Retrieve the record
record, err := eastest.DefaultClient().GetRecord(ctx, res.ID.Value)
require.NoError(t, err)
require.Equal(t, res.ID.Value, record.ID)
require.Equal(t, "This is my archive file", record.Title)
require.Equal(t, "DE123456789", record.GetHeaderFieldVal("Creditor"))
require.Equal(t, "DE987654321", record.GetHeaderFieldVal("Debitor"))
}