feat: organizations and API keys
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
||||
)
|
||||
|
||||
func TestAddAPIKey_Event(t *testing.T) {
|
||||
type fields struct {
|
||||
Name string
|
||||
Key string
|
||||
Refs []string
|
||||
Read bool
|
||||
Publish bool
|
||||
Initiator string
|
||||
}
|
||||
type args struct {
|
||||
in0 context.Context
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
fields fields
|
||||
args args
|
||||
want eventsourced.Event
|
||||
}{
|
||||
{
|
||||
name: "event",
|
||||
fields: fields{
|
||||
Name: "test",
|
||||
Key: "us_ak_1234567890123456",
|
||||
Refs: []string{"Example@dev"},
|
||||
Read: true,
|
||||
Publish: true,
|
||||
Initiator: "jim@example.org",
|
||||
},
|
||||
args: args{},
|
||||
want: &APIKeyAdded{
|
||||
Name: "test",
|
||||
Key: "dXNfYWtfMTIzNDU2Nzg5MDEyMzQ1NuOwxEKY/BwUmvv0yJlvuSQnrkHkZJuTTKSVmRt4UrhV",
|
||||
Refs: []string{"Example@dev"},
|
||||
Read: true,
|
||||
Publish: true,
|
||||
Initiator: "jim@example.org",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
a := AddAPIKey{
|
||||
Name: tt.fields.Name,
|
||||
Key: tt.fields.Key,
|
||||
Refs: tt.fields.Refs,
|
||||
Read: tt.fields.Read,
|
||||
Publish: tt.fields.Publish,
|
||||
Initiator: tt.fields.Initiator,
|
||||
}
|
||||
assert.Equalf(t, tt.want, a.Event(tt.args.in0), "Event(%v)", tt.args.in0)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user