fix: convert customer, session ids to uuid for json un/marshal
This commit is contained in:
19
main_test.go
19
main_test.go
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go-nkode/core/api"
|
||||
m "go-nkode/core/model"
|
||||
@@ -25,7 +26,7 @@ func TestApi(t *testing.T) {
|
||||
|
||||
username := m.Username("test_username")
|
||||
signupInterfaceBody := m.GenerateSignupInterfacePost{
|
||||
CustomerId: customerResp.CustomerId,
|
||||
CustomerId: uuid.UUID(customerResp.CustomerId),
|
||||
AttrsPerKey: kp.AttrsPerKey,
|
||||
NumbOfKeys: kp.NumbOfKeys,
|
||||
Username: username,
|
||||
@@ -40,8 +41,8 @@ func TestApi(t *testing.T) {
|
||||
setKeySelection, err := m.SelectKeyByAttrIdx(setInterface, userPasscode, kp_set)
|
||||
assert.NoError(t, err)
|
||||
setNKodeBody := m.SetNKodePost{
|
||||
CustomerId: customerResp.CustomerId,
|
||||
SessionId: signupInterfaceResp.SessionId,
|
||||
CustomerId: uuid.UUID(customerResp.CustomerId),
|
||||
SessionId: uuid.UUID(signupInterfaceResp.SessionId),
|
||||
KeySelection: setKeySelection,
|
||||
}
|
||||
var setNKodeResp m.SetNKodeResp
|
||||
@@ -50,14 +51,14 @@ func TestApi(t *testing.T) {
|
||||
confirmKeySelection, err := m.SelectKeyByAttrIdx(confirmInterface, userPasscode, kp_set)
|
||||
assert.NoError(t, err)
|
||||
confirmNKodeBody := m.ConfirmNKodePost{
|
||||
CustomerId: customerResp.CustomerId,
|
||||
CustomerId: uuid.UUID(customerResp.CustomerId),
|
||||
KeySelection: confirmKeySelection,
|
||||
SessionId: signupInterfaceResp.SessionId,
|
||||
SessionId: uuid.UUID(signupInterfaceResp.SessionId),
|
||||
}
|
||||
testApiPost(t, base+api.ConfirmNKode, confirmNKodeBody, nil)
|
||||
|
||||
loginInterfaceBody := m.GetLoginInterfacePost{
|
||||
CustomerId: customerResp.CustomerId,
|
||||
CustomerId: uuid.UUID(customerResp.CustomerId),
|
||||
Username: username,
|
||||
}
|
||||
|
||||
@@ -67,20 +68,20 @@ func TestApi(t *testing.T) {
|
||||
loginKeySelection, err := m.SelectKeyByAttrIdx(loginInterfaceResp.UserIdxInterface, userPasscode, kp)
|
||||
assert.NoError(t, err)
|
||||
loginBody := m.LoginPost{
|
||||
CustomerId: customerResp.CustomerId,
|
||||
CustomerId: uuid.UUID(customerResp.CustomerId),
|
||||
Username: username,
|
||||
KeySelection: loginKeySelection,
|
||||
}
|
||||
|
||||
testApiPost(t, base+api.Login, loginBody, nil)
|
||||
|
||||
renewBody := m.RenewAttributesPost{CustomerId: customerResp.CustomerId}
|
||||
renewBody := m.RenewAttributesPost{CustomerId: uuid.UUID(customerResp.CustomerId)}
|
||||
testApiPost(t, base+api.RenewAttributes, renewBody, nil)
|
||||
|
||||
loginKeySelection, err = m.SelectKeyByAttrIdx(loginInterfaceResp.UserIdxInterface, userPasscode, kp)
|
||||
assert.NoError(t, err)
|
||||
loginBody = m.LoginPost{
|
||||
CustomerId: customerResp.CustomerId,
|
||||
CustomerId: uuid.UUID(customerResp.CustomerId),
|
||||
Username: username,
|
||||
KeySelection: loginKeySelection,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user